@hexonet/ispapi-apiconnector
Advanced tools
Comparing version 4.3.0 to 4.3.1
@@ -6,2 +6,7 @@ ### Changelog | ||
#### [v4.3.1](https://github.com/hexonet/node-sdk/compare/v4.3.0...v4.3.1) | ||
> 28 June 2018 | ||
- initial review after package scoping [`63c0005`](https://github.com/hexonet/node-sdk/commit/63c00055e293a1de3fe45ebb66196c505f7a82e2) | ||
- migrate to @hexonet scope [`0bc5589`](https://github.com/hexonet/node-sdk/commit/0bc55891b0c398e2cdc8e02904989bf6bee8f803) | ||
#### [v4.3.0](https://github.com/hexonet/node-sdk/compare/v4.2.0...v4.3.0) | ||
@@ -8,0 +13,0 @@ > 27 June 2018 |
{ | ||
"name": "@hexonet/ispapi-apiconnector", | ||
"description": "Node.js SDK for the insanely fast HEXONET API", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Kai Schwarz", |
@@ -1,9 +0,10 @@ | ||
# ispapi-apiconnector | ||
# node-sdk | ||
This module is a connector library for the insanely fast 1API backend API. | ||
For further informations visit our homepage http://1api.net and do not hesitate to contact us. | ||
This module is a connector library for the insanely fast HEXONET Backend API. For further informations visit our [homepage](https://www.hexonet.net) and do not hesitate to [contact us](https://www.hexonet.net/contact). | ||
## Installation | ||
$ npm install ispapi-apiconnector | ||
```bash | ||
npm install @hexonet/ispapi-apiconnector@latest | ||
``` | ||
@@ -13,2 +14,3 @@ ## Usage | ||
### API response format | ||
If you got the API communication working, you will notice that we provide two response formats via this library. | ||
@@ -25,2 +27,3 @@ a) hash format | ||
``` | ||
The default value for type is "hash". Thus not providing this parameter automatically returns the hash format. | ||
@@ -31,2 +34,3 @@ The list format makes sense, if you're working with table libraries based on our list commands and need the hash format parsed into a list format. | ||
### API response codes | ||
The API response (a JSON object) provides always two keys: CODE and DESCRIPTION. | ||
@@ -44,4 +48,5 @@ CODE represents a return code which indicates the following cases: | ||
### API login procedure | ||
```js | ||
var apiconnector = require('ispapi-connector') | ||
var apiconnector = require('@hexonet/ispapi-connector') | ||
, apiclient = new apiconnector.Client() | ||
@@ -73,6 +78,7 @@ , socketparameters, cb; | ||
### API command request | ||
After login, you should reuse the above 'socketcfg' parameter in further requests which is the simplest and best way. | ||
```js | ||
var apiconnector = require('ispapi-apiconnector') | ||
var apiconnector = require('@hexonet/ispapi-apiconnector') | ||
, apiclient = new apiconnector.Client() | ||
@@ -97,7 +103,11 @@ , cb, cberr; | ||
``` | ||
NOTE: You have to login first. The login callback provides an updated socketcfg variable which has to be reused in the request and logout method. | ||
### API logout | ||
```js | ||
var apiconnector = require('ispapi-connector') | ||
'use strict'; | ||
var apiconnector = require('@hexonet/ispapi-connector') | ||
, apiclient = new apiconnector.Client() | ||
@@ -115,5 +125,7 @@ , cb; | ||
``` | ||
NOTE: You have to login first. The login callback provides an updated socketcfg variable which has to be reused in the request and logout method. | ||
## Working example | ||
This example is thought for anyone who builds up his own frontend including user login and logout functionality. | ||
@@ -123,7 +135,7 @@ See how login and logout works and how the request method depends on the login mechanism! | ||
Note: you have to first finish your requests before doing logout. Running requests may fail after logout. | ||
```js | ||
'use strict'; | ||
var apiconnector = require('ispapi-apiconnector'), | ||
var apiconnector = require('@hexonet/ispapi-apiconnector'), | ||
apiclient = new apiconnector.Client(), | ||
@@ -177,2 +189,3 @@ socketparameters; | ||
## Working example (without API session) | ||
In the below example no login / logout procedure is required. | ||
@@ -182,10 +195,10 @@ This is thought for cases where a user session is not of interest. | ||
If you want to build your frontend based on this library, we suggest to base it on the above example. | ||
```js | ||
'use strict'; | ||
var apiconnector = require('ispapi-apiconnector'), | ||
var apiconnector = require('@hexonet/ispapi-apiconnector'), | ||
apiclient = new apiconnector.Client(), | ||
socketparameters = { | ||
params: { | ||
params: { | ||
entity: '1234', | ||
@@ -208,5 +221,7 @@ remoteaddr: '1.2.3.4:80', | ||
## FAQ | ||
Nothing added yet. | ||
## License | ||
MIT |
94035
217