Consignment API

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:


Linux CURL request
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:

Field

Description

Mandatory

Date Type

is_urgent

Is urgent?



TINYINT(1)

delivery_service_id

Delivery Service ID

Yes

INT(4)

sales_reference

Sale Reference



VARCHAR(50)

sales_price

Order Sales Price



DECIMAL(10, 3)

sales_order_id

eBay or Amazon order ID



VARCHAR(50)

delivery_reference

Tracking Reference No.



VARCHAR(50)

contact

Contact Name

Yes

VARCHAR(100)

business_name

Business Name



VARCHAR(255)

address_line1

Address Line 1

Yes

VARCHAR(100)

address_line2

Address Line 2



VARCHAR(100)

address_line3

Address Line 3



VARCHAR(100)

city

City

Yes

VARCHAR(50)

county

County



VARCHAR(50)

post_code

Postcode



VARCHAR(10)

country_iso

Country ISO

Yes

CHAR(2)

telephone

Telephone



VARCHAR(50)

email

Email



VARCHAR(255)

special_instruction:

Note1



VARCHAR(255)

neighbour_instruction:

Note2



VARCHAR(255)

type

Consignment Type



ENUM('LOCAL','DIRECT','RETURN','AGENT_DIRECT')

Return

{ "success":true, "data":{ "id":"2006143004830001", "delivery_service_id":"12010433", "...":"..." } }