npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@eway-crm/connector

v1.0.192

Published

eWay-CRM API JavaScript connector library.

Downloads

499

Readme

eWay-CRM Logo

eWay-CRM API

API used for communication with eWay-CRM web service. This library is a wrapper over HTTP/S communication and sessions. See our documentation for more information.

Installation

The simpliest way to start using this library is to get the NPM Package. To do that, just run this command in your NodeJS project's root dir:

npm i @eway-crm/connector

To get the best dev experience, we also recommend using TypeScript since this library contains the types headers.

Usage

This library wraps the communication with JSON API. For HTTP requests, it uses Axios. To provide the most variability, it lets you input JSON data and fetch JSON data in the same structure as the server uses. The only thing you don't have to care about is the sessionId.

The actual usage is then the same as it would be for example with PHP. See the documentation for more.

Version Compatibility

This library is compatible with eWay-CRM 6.0.1 and higher. If you have got a lower version of your eWay-CRM, check the Updates section in the eWay-CRM Administration Application. If there is no update available, contact your eWay-CRM account manager or via other channel listed on our web page.

Establishing Connection

To communicate with eWay-CRM web service, we first have to establish connection. This must be done prior to every action we want to accomplish with use of the web service. To do that, we have to create new instance of ApiConnection with seven parameters:

  1. Service url address (same as the one you use in Outlook)
  2. Username
  3. Password hash (md5 of the user's UTF8 password or hash created by the tool from eWay-CRM server component)
  4. App version identifier (name and version of the connecting client app - must consist of alphabet string and digits at the end)
  5. Client machine identifier (unique identifier of the connecting machine - MAC address for instance)
  6. Client machine name (human readable client machine - PC name for instance)
  7. Error handling callback (this callback is called everytime an unexpected error occurs)
import ApiConnection from '@eway-crm/connector';

const serviceUrl = 'https://trial.eway-crm.com/31994';
const username = 'api';
const passwordHash = '470AE7216203E23E1983EF1851E72947';

const connection = ApiConnection.create(serviceUrl, username, passwordHash, 'JSSample1', '00:00:00:00:00', 'SampleTestMachine', (err) => console.error(err));

⚠️ The code above does not support Microsoft Account Authenticaion. If you log into eWay-CRM with your Microsoft account, you need to implement your own OAuth2 client.

CORS

If you are developing a web app running on a different host than your eWay-CRM web service, you need to configure your eWay-CRM web service to allow cross-origin requests. To achieve that, put the following setting into appSettings section of your web service's web.config file.

<add key="AccessControlAllowOrigin" value="https://YOUR-ORIGIN:PORT" />

⚠ If you add the setting above to your web.config, the web-based eWay-CRM Administration Center won't work in Internet Explorer, which will be a huge loss for the whole humankind.

Using the Connection Object

Once having the ApiConnection instance, the API requests look like this searching of our user record.

connection.callMethod(
    'SearchUsers',
    {
        transmitObject: { Username: username },
    },
    (result) => {
        console.log('My user detail follows:');
        console.log(result.Data[0]);
    }
);