sellmate-utils
Useful authentication module to help you connect your App with Sellmate. REST API Documentation is also available here.
Installation
$ npm install sellmate-utils
or add it to your project dependencies package.json
"dependencies":
Quick start - OAuth2
-
Create a new OAuth2 object with some parameters (
host
is optional, default is 'auth.sellmate.com'):var oa = client_id client_secret redirectUri host;eg: var oa = '1234' 'qwertasdfgzxcv' 'http://localhost:8888/callback'; -
Get the OAuth Request Token URL and call it (parameters are optional, i.e.
shop
):var authUrl = oa;eg: var authUrl = oa; -
Your App should have a callback servlet (i.e. http://localhost:8888/callback) where you get the notification with the
code
as a query parameter. Then you can request an AccessToken:oa;
Quick start - REST
-
Create a new Rest object with the target url and the parameters needed for the authentication (
mac_key
andaccess_token
):var target = "http://api.sellmate.com/<shop-handle>/rest/<resource>";var rest = target"mac_key": "abcd""access_token": "abcd"; -
Use one of the four verbs
CRUD
to access a resource:rest; -
You can also request the
Authorization Header
with:var authHeader = rest;