Any order in the system can be linked to a customer. 

Get a list of customers

Authorization is required. There are no input parameters. 

GET /v1.0/customers

Pagination and sorting are available for the query. Available sorting fields: default (CompanyName,LastName,FirstName), name (LastName,FirstName), company (CompanyName). Default sorting and pagination parameter values: sortby=default&direction=asc&offset=0&limit=100.

In this query, it is possible to specify the parameter type=company (type=person) to select only legal entities (individuals). If the parameter is not specified or does not match one of {company, person}, then all clients (both companies and individuals) will be selected.

The query has an optional parameter archived=false (archived=true) - it is used to display non-archived records (archived records). By default, the query displays all records - both archived and non-archived.

Returns the customers array: 

{
"customers": [
{
"_id": 8,
"description": "test",
"email": "cust@gmail.com",
"name": "My first name",
"lastname":"My last name",
"companyname": "Google",
"phone": "123-12-12",
"status": 0,
"archived": false,
"archivationdate": 0,
"crmid": "",
"refid": ""
}]}

Get a customer by ID

Authorization is required. There are no input parameters. 

GET /v1.0/customers/{id}

Returns the customer object:

{
    "customer": {
        "_id": 4,
        "archivationdate": 0,
        "archived": false,
        "companyname": "",
        "description": "",
        "email": "mail@gmail.com",
        "lastname": "",
        "name": "Peter",
        "phone": "8",
        "status": 1,
        "crmid": "",
        "refid": ""
    }
}

Create a new customer 

Authorization is required. RAW JSON input parameters:

{
 " customerName" : "My first name",
  "customerLastName": "My last name",
  "customerEmail" : "postman@gmail.com",
  "customerCompanyName": "Google",
  "customerPhone" : "123-11-11",
  "customerDescription" : "Created by postman",
  "customerStatus" : 0,
  "archived": false,
  "crmId": "",
  "refId": ""
}

POST /v1.0/customers

Returns the customer element: 

{
  "customer": {
  "_id": 9,
  "description": "Created by postman",
  "email": "postman@gmail.com",
  "name": "PostMan",
  "lastname":"My last name",
  "companyname": "Google",
  "phone": "123-11-11",
  "status": 0,
  "archived": false,
  "archivationdate": 0,
  "crmid": "",
  "refid": ""
}
}

Change customer 

Authorization is required. RAW JSON input parameters:

{
  "customerName" : "PostManPut",
  "customerLastName": "My last name",
  "customerEmail" : "postman@gmail.com",
  "customerCompanyName": "Google",
  "customerPhone" : "111-11-11",
  "customerDescription" : "Created by postman By",
  "customerStatus" : 1,
  "archived": false,
  "crmId": "",
  "refId": ""
}

PUT /v1.0/customers/{id}

Returns the customer element:

{
  "customer": {
    "_id": 9,
    "description": "Created by postman By",
    "email": "postman@gmail.com",
    "name": "PostManPut",
    "lastname":"My last name",
    "companyname": "Google",
    "phone": "111-11-11",
    "status": 1,
    "archived": false,
    "archivationdate": 0,
    "crmid": "",
	"refid": ""
}}

Remove a customer 

Authorization is required. There are no input parameters. 

DELETE /v1.0/customers/{id}

Get a list of customer orders 

Authorization is required. 

GET /v1.0/customers/{id}/orders

Pagination and sorting are available for the query. Available sorting fields: number, submitdate. Default sorting and pagination parameter values: sortby=number&direction=asc&offset=0&limit=100.

Filter by order status is available for the query: Draft(0), Submit(1), Revoked(2). By default, the query returns orders with any status. If you need to select orders with specific statuses, list them separated by commas in the "status" query parameter. For example, specifying status=0,1 will return only orders with the Draft(0) and Submit(1) status.

Returns the orders array: 

{
    "orders": [
        {
            "_id": 10016,
            "activationbirthdate": 0,
            "activationdeathdate": 0,
            "activationlimit": 7,
            "archivationdate": 0,
            "archived": false,
            "canoverwritecontainer": false,
            "customerrequired": true,
            "date": 1527501148,
            "description": "With client",
            "isdemo": false,
            "number": 0,
            "quantity": 2,
            "status": 0,
            "submitdate": 0,
            "type": 0,
            "crmid": "",
            "refid": ""
        },
        {
            "_id": 10096,
            "activationbirthdate": 1538463338,
            "activationdeathdate": 0,
            "activationlimit": 1,
            "archivationdate": 0,
            "archived": false,
            "canoverwritecontainer": false,
            "customerrequired": true,
            "date": 1538463338,
            "description": "test bugs in sn activation number",
            "isdemo": false,
            "number": 0,
            "quantity": 10,
            "status": 1,
            "submitdate": 0,
            "type": 0,
            "crmid": "",
            "refid": ""
        }
    ]
}
  • No labels