The CommerceInterface API end-point URL is https://scm.commerceinterface.com/api/v2/.
All API calls require authentication. Authentication credentials are Supplier ID and Token. Suppliers can generate access token by clicking here. Parameters for Supplier ID and Token are supplier_id and token respectively. All api calls must send both the parameters.
To get a list of orders in Supplier's account.
Parameter | Description |
---|---|
supplier_id | CommerceInterface supplier id. |
token | Authentication token. Suppliers can generate access token by clicking here. |
Response:
- curl -XGET "https://scm.commerceinterface.com/api/v2/get_orders?supplier_id=1&token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT"
- {
- "meta": {
- "no_of_pages": 1,
- "current_page": 1,
- "max_items_per_page": 250,
- "no_of_items": 1
- },
- "data": [{
- "orderid": "FFB7A681BE",
- "customer": {
- "city": "BRADFORD",
- "state": null,
- "name": "SOME BODY HERE",
- "zip": "SOME ZIP",
- "country": null,
- "address1": "901",
- "address2": "GREENFIELDS LANE",
- "phone": "01234 982103"
- },
- "line_items": [{
- "sku": "03658246",
- "name": "SOME PACK OF 6",
- "weight": 0.0,
- "bom_sku": null,
- "unit_price": 10.99,
- "ci_lineitemid": 54553918,
- "quantity": 1
- }],
- "shipping": {
- "carrier": null,
- "method": "BEST"
- },
- "date": "05/16/2013 08:10AM UTC",
- "amount": {
- "total": 10.99,
- "shipping": 0
- },
- "supplier": "SUPPLIER NAME"
- }],
- "success": true
- }
- import requests #requires "requests" package
- response = requests.get('https://scm.commerceinterface.com/api/v2/get_orders',
- data={'supplier_id':'1', 'token':'xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT'}).json()
- if response['success'] == True:
- #Your business logic here
- print response
- else:
- #Alarm!
- pass
- <?php
- $response = file_get_contents ( 'https://scm.commerceinterface.com/api/v2/get_orders?supplier_id=1&token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT' );
- if( $response ) {
- $response_json = json_decode ( $response );
- if( $response_json->success == true ) {
- //Your business logic here
- } else {
- //Alarm!
- }
- }
Parameters | Description |
---|---|
start_datetime | Use this parameter if you want to pull orders between a time range. It should be used in combination with end_datetime parameter. Both the parmaeters should be in 24 hours range. Timestamp should be in MM/DD/YYYY HH:MM format (UTC). All order data is returned irrespective they are marked as exported or not. |
end_datetime | Same as start_datetime except that it is used to determine the end of time range. |
page | The responses has 250 items per page. To get data from next page use this parameter. |
This endpoint is to acknowledge that lineitem(s) has been exported.
Parameter | Description |
---|---|
supplier_id | CommerceInterface supplier id. |
token | Authentication token. Suppliers can generate access token by clicking here. |
ci_lineitem_ids | A list of ci_lineitemid in json format. It supports upto 1000 ci_lineitemid at a time. |
Response:
- curl -XPOST "https://scm.commerceinterface.com/api/v2/mark_exported" \
- -d"supplier_id=1" \
- -d"token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT" \
- -d"ci_lineitem_ids=[54553919, 54553920]"
- {
- "success": true
- }
- import requests #requires "requests" package
- import json
- response = requests.post('https://scm.commerceinterface.com/api/v2/mark_exported',
- data={'supplier_id':'1', 'token':'xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT',
- 'ci_lineitem_ids':json.dumps([54553919, 54553920])}).json()
- if response['success'] == True:
- #Successfully marked as exported (only items which are not already marked exported)
- pass
- else:
- pass
- <?php
- // requires PHP cURL http://no.php.net/curl
- $datatopost = array (
- "supplier_id" => "1",
- "token" => "xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT",
- "ci_lineitem_ids" => json_encode ( array (54553919, 54553920) ),
- );
- $ch = curl_init ("https://scm.commerceinterface.com/api/v2/mark_exported");
- curl_setopt ($ch, CURLOPT_POST, true);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- $response = curl_exec ($ch);
- if( $response ) {
- $response_json = json_decode( $response );
- if( $response_json->success == true ) {
- //Successfully marked as exported (only items which are not already marked exported
- } else {
- }
- }
To send tracking information about a lineitem.
Parameter | Description |
---|---|
supplier_id | CommerceInterface supplier id. |
token | Authentication token. Suppliers can generate access token by clicking here. |
tracking_info | A list of json objects having ci_lineitem_id, carrier & tracking. Additionally it also supports quantity which you can use if you ship items less than the ordered quantity. It supports upto 1000 lineitems at a time. In case a lineitem is already closed or cancelled it will be skipped. In case of any other error no data will be saved. |
Response:
- curl -XPOST "https://scm.commerceinterface.com/api/v2/tracking_notification" \
- -d"supplier_id=1" \
- -d"token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT" \
- -d'tracking_info=[{"carrier": "UPS", "ci_lineitem_id": 54553918, "tracking": "123456"}, {"quantity": 1, "carrier": "UPS", "ci_lineitem_id": 54553919, "tracking": "234567"}]'
- {
- "success": true,
- "data": {
- "non_open_ids": []
- }
- }
- import requests #requires "requests" package
- import json
- req_data = {'supplier_id':'1',
- 'token':'xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT',
- 'tracking_info':json.dumps([
- {"carrier": "UPS", "ci_lineitem_id": 54553918, "tracking": "123456"},
- {"quantity": 1, "carrier": "UPS", "ci_lineitem_id": 54553919, "tracking": "234567"}])}
- response = requests.post('https://scm.commerceinterface.com/api/v2/tracking_notification',
- data=req_data).json()
- if response['success'] == True:
- #Successfully saved tracking info of items other than those in data["non_open_ids"] list
- pass
- else:
- pass
- <?php
- // requires PHP cURL http://no.php.net/curl
- $datatopost = array (
- "supplier_id" => "1",
- "token" => "xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT",
- "tracking_info" => json_encode ( array ( "carrier" => "UPS", "ci_lineitem_id" => 54553918, "tracking" => "123456"), array ( "quantity" => 1, "carrier" => "UPS", "ci_lineitem_id" => 54553919, "tracking" => "234567") ),
- );
- $ch = curl_init ("https://scm.commerceinterface.com/api/v2/tracking_notification");
- curl_setopt ($ch, CURLOPT_POST, true);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- $response = curl_exec ($ch);
- if( $response ) {
- $response_json = json_decode( $response );
- if( $response_json->success == true ) {
- //Successfully saved tracking info of items other than those in data["non_open_ids"] array
- } else {
- }
- }
To get a list of purchaseorders in Supplier's account within given date range.
Parameter | Description |
---|---|
supplier_id | CommerceInterface supplier id. |
token | Authentication token. Suppliers can generate access token by clicking here. |
Response:
- curl -XGET "https://scm.commerceinterface.com/api/v2/purchase_orders?supplier_id=1&token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT"
- {
- "po_details": [
- {
- "supplier":"3pl excel"
- "po_number": "POUSGG00000xxxF5",
- "po_created_on": "SOME DATE",
- "permalink": "SOME PERMALINK",
- "fulfillment_provider": "SOME FULFILLMENT PROVIDER",
- "po_upc_list":
- [
- {
- "upc": "UPC1",
- "received_quantity": 100,
- "total_quantity": 300,
- "expected_quantity": 200,
- "total_weight": 0.0 ,
- "weight_unit":pounds
- },
- ]
- },
- ]
- "success": true
- }
- import requests #requires "requests" package
- response = requests.get('https://scm.commerceinterface.com/api/v2/purchase_orders',
- data={'supplier_id':'1', 'token':'xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT','start_date':'1377734400','end_date':'1379289600'}).json()
- if response['success'] == True:
- #Your business logic here
- print response
- else:
- #Alarm!
- pass
- <?php
- $response = file_get_contents ( 'https://scm.commerceinterface.com/api/v2/purchase_orders?supplier_id=1&token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT&start_date=1377734400&end_date=1379289600' );
- if( $response ) {
- $response_json = json_decode ( $response );
- if( $response_json->success == true ) {
- //Your business logic here
- } else {
- //Alarm!
- }
- }
Parameters | Description |
---|---|
start_datetime | Use this parameter if you want to pull purchase orders between a time range. It should be used in combination with end_datetime parameter. Timestamp should be in epoch format.Epoch time can be found here. Select "GMT" in timezone dropdown . |
end_datetime | Same as start_datetime except that it is used to determine the end of time range. |
page | The responses has 25 items per page. To get data from next page use this parameter. |
This endpoint is to acknowledge that purchaseorder has been exported.
Parameter | Description |
---|---|
supplier_id | CommerceInterface supplier id. |
token | Authentication token. Suppliers can generate access token by clicking here. |
po_number | Valid purchaseorder number should be provided . |
Response:
- curl -XPOST "https://scm.commerceinterface.com/api/v2/purchase_orders/acknowledgement" \
- -d"supplier_id=1" \
- -d"token=xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT" \
- -d"po_number=POUSGG00XXX123"
- {
- "success": true,
- "po_number":POUSGG00XXX123
- }
- import requests #requires "requests" package
- import json
- response = requests.post('https://scm.commerceinterface.com/api/v2/purchase_orders/acknowledgement',
- data={'supplier_id':'1', 'token':'xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT',
- 'po_number':'POUSGG00XXX123'}).json()
- if response['success'] == True:
- #Successfully marked as acknowledged (only items which are not already marked acknowledged)
- pass
- else:
- pass
- <?php
- // requires PHP cURL http://no.php.net/curl
- $datatopost = array (
- "supplier_id" => "1",
- "token" => "xYRPKcoakMoiRzWgKLV5TqPSdNAaZQT",
- "po_number" => "POUSGG00XXX123",
- );
- $ch = curl_init ("https://scm.commerceinterface.com/api/v2/purchase_orders/acknowledgement");
- curl_setopt ($ch, CURLOPT_POST, true);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $datatopost);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- $response = curl_exec ($ch);
- if( $response ) {
- $response_json = json_decode( $response );
- if( $response_json->success == true ) {
- //Successfully marked as acknowledged (only items which are not already marked acknowledged
- } else {
- }
- }