Consignment API
There are three ways to create Consignments in system :
1. To create a Consignment firstly, then add one or more SKUs to the Consignment, Finally updating the Status of Consignment to the PENDING, which is a status system ready to process.
2. The second way is, to create the Batch Consignments temporarily first, then batch converting those Batch Consignments to the final Consignments.
3. The third way is, to create a Consignment in a all-in-one API Request. This way is simplest way to create and manage Consignments via API, In addtion, under this way, the Status of Consignment will be updated to the PENDING straightway.
The detail of reference below :
1. Request and Credential
To interact with system's API you'll need both api_key and company_id, both are mandatory in all cases.
Get API Key
To create an API KEY please log on the Client web interface (http://{domain}/client) first with your given username and password.
Go to Settings → User
Double click the record line or click icon to open the detail view window.
If there no existing API Key you'll need to click the 'Generate a new key' button to create one.
Once the API Key is generated, you need to add api_key HTTP Header with according value in your RESTFul requests.
Get company_id
Visit the URL http://{domain}/client/public/company-list to get a list of companies , alternatively you can use your preferred RESTFul tools to get the list.
(In the example below we are using PostMan REST Client)
Create Request (GET)
You are all set to request to our server now.
For example, to lease all Client Users under current account:
curl -H "api_key: fd7ee0f2f86b41c0b00dd0f5c2281a61" -H "company_id: 1" http://{domain}/client/Client-User
You can also use PostMan to request for pretty response print out:
Create Request (POST)
You can submit your POST request either in HTTP Form format or JSON format.
To send request in Form format you need to add 'Content-Type:application/x-www-form-urlencoded' in your HTTP Header.
To send request in JSON format you need to add 'Content-Type:application/json' in your HTTP Header.
Form format:
JSON Format
Please note the in the above example we used an existed username so the server prompted error message, this is to demonstrate how server would response errors:
- A 500 HTTP status code would be returned
- Server will return "success":false in the returned JSON
- A detailed explanation message is returned.
2. Creating a Consignment one step by one step
1) Creating a Consignment
Post a request with params below:
url | http://{domain}/client/Consignment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
method | post | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
body | form parmas:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return | {
"success":true,
"data":{
"id":"2006143004830001",
"delivery_service_id":"12010433",
"...":"..."
}
} |
