Codelayer API Documentation

  • Introduction

    • General
  • API Reference

    • System

      • License request
      • Register Device
      • Authentication
    • Sales

      • Add Customer
      • Check Customer
      • Device Location
      • Master Place
      • Master Routes
      • Product Summary
      • Return details
      • Route Customers
      • Route Details
      • Route Path
      • Route Products
      • Route Products Return
      • Route Report
      • Route Return
      • Route Salesmen
      • Route Save
      • Route Save With Remarks
      • Route Shops
      • Sales Closing
      • Stock Transfer
      • Update Device Token
    • Response Codes
Codelayer API Documentation
Authentication

Authenticates a user to the API using user name and password. On successful authentication a key is provided. For any further communication to the API the provided key must be used. This key expire/timeout. On such situations the application has to get another key by re-authentication to the API.

URL

system/auth

Method

POST

Request Media type

application/json

Response Media type

application/json

Request Parameters
Parameter Data Type Min Max M/O Sample Value Comments
username String 1 64 M TEST This is the username provided to login to the API
password String 1 64 M password This is the password provided to login to the API
imei String 14 16 M 352099001761481 IMEI of the accessing device.
ver String 7 16 M 1.0.0.0 Application version of the client. Current supported version is 1.0.0.0
license_key String O CAxLcQc5V1hc8VNe2pzxDQz+jaI+jf3FU+cp4E5oslD9EN6Rki8Ma3aFp01ilr3/Ycw6jU3fvLVrskJO5Yau4g License key to identify the client. If no license key is provided by the licensing server this field can be ignored.

 

Response Values
Name Data Type Min Length Max Length M/O Sample Value Comments
key String 32 32 M QH7LlQ3wQMK9oYEKjeG5QOIVJQT4emeq This key to be used for all API calls (256 bit)
features String M 2,3 Coma seperated list of feature IDs available for the user.

 

Sample Request
{
    "username": "TEST",
    "password": "password",
    "imei": "352099001761481",
    "ver": "1.0.0.0",
    "license_key": "CAxLcQc5V1hc8VNe2pzxDQz+jaI+jf3FU+cp4E5oslD9EN6Rki8Ma3aFp01ilr3/Ycw6jU3fvLVrskJO5Yau4g"
}
Sample Success Response
{
    "key": "QH7LlQ3wQMK9oYEKjeG5QOIVJQT4emeq",
    "features": "2,3",
    "e": 200,
    "msg": "Success"
}
Sample Failure Responses
{
    "e": 400,
    "msg": "Bad Request."
}
{
    "e": 401,
    "msg": "Invalid authentication credentials."
}