Cubyn API is the most flexible way to integrate your logistics with Cubyn.
In particular, it allows you to :
- Import your shipment information
- Track your shipments: shipment status & tracking number
- Be notified for every shipment statuses changes.
You can find all the documentation of our API on this dedicated website : http://developers.cubyn.com.
Connecting the Cubyn API
In order to connect to the Cubyn API, you must first add the Cubyn API application to your space.
To do so, go to your Cubyn account and follow these steps :
- Go to the Apps tab
- Click on the + button
- Click Install next to the Cubyn API icon.
- Enter the name of the application you wish to display on your space
- Confirm
To connect to this application from your service, you need to retrieve your authentication key. You will find it in the details of the Cubyn API application.
You can access it from the App tab by selecting the wrench next to the application. This will retrieve your authentication key.
Thanks to this API connection, you can perform the following actions:
1- Send inventory
In order to send inventory, it is necessary to indicate the number of packing units to be shipped and to provide us with the details by product : SKU, product name, barcode and quantity.
These elements will have to be entered in the locations indicated on the stock shipment request that can be found here.
{
"packingUnits": 2,
"items": [{
"sku": "SKU1",
"productName": "Name1",
"barcode": "123456789",
"quantity": 4
},
{
"sku": "SKU2",
"productName": "Name2",
"barcode": "234567890",
"quantity": 90
}]
}
You will get in response the WIO ID (pid) associated to your stock shipment as well as the number of packages and products declared.
{
...
"pid": "184569",
...
"declaredPackingUnits": 2,
"receivedPackingUnits": 0,
"completedPackingUnits": 0,
"declaredItems": 94,
"storedItems": 0,
"createdAt": "2020-05-25T09:37:29.000Z",
"updatedAt": "2020-05-25T09:37:29.000Z",
"receiptStartedAt": null,
"validatedAt": "2020-05-25T09:37:29.000Z",
"completedAt": null,
"deletedAt": null,
...
}
2- Track inventory
It is possible for you to follow your inventory in real time by using the associated query found here.
This query will display various information by SKU including the number of products being received, available, being processed and shipped, as well as the associated barcode(s).
[
{
...
"sku": "iPhone_10_32G_new",
"sanitizedSku": "IPHONE-10-32G-NEW",
"name": "iPhone 10 32G new",
"isVirtual": false,
"isBundle": false,
"createdAt": "2020-05-07T14:59:45.000Z",
"updatedAt": "2020-05-07T14:59:45.000Z",
...
"stock": {
"hadStockInbounded": true,
"quantityAvailable": 7,
"quantityOutbounded": 0,
"quantityInbounding": 0,
"quantityOutbounding": 1,
...
},
...
},
...
]
3- Create a parcel
You need to provide different information about the recipient of each shipment but also the SKUs of the products and the quantity you want to ship any order. The details of this information needed to create a shipment are available here.
{
"type":"SHIPMENT",
"firstName":"Sophie",
"lastName":"Martin",
"items":[
{
"reference":"SKU1",
"count":1
}
],
"orderRef": "Order1",
"address":{
"line1":"13 rue Lecourbe",
"zip":"75007",
"city":"Paris",
"country":"France",
"additionalInformation":"code 9898"
},
"value": 10.99
}
Once the request has been sent, it will return you a summary of the shipment details with the associated information.
{
...
"trackingId": "CUB131958015",
"status": "CREATED",
...
"address": {
"line1": "13 rue Lecourbe",
"line2": "",
"zip": "75007",
"city": "Paris",
"state": "",
"country": "FR",
"additionalInformation": "code 9898"
},
"firstName": "Sophie",
"lastName": "Martin",
"value": 10.99,
"deliveryMode": "standard",
"deliverySigned": false,
"objectCount": 1,
"insurance": 0,
"isAdvalorem": false,
"orderRef": "Order1",
"createdAt": "2020-05-25T10:07:28.000Z",
"updatedAt": "2020-05-25T10:07:28.000Z",
...
"items": [
{
"reference": "SKU1",
"count": 1
}
],
...
}
4- Track your shipments (or a specific one)
Finally, you can track your shipments using the associated query found here.
By indicating the id at the end of the query, you will find the details of the shipment, including the recipient's details and the status of it. You can also have the complete information of all your orders if you don't enter any id.
5- Webhooks
You can also add in the settings of the Cubyn API application the URL of the Webhook to which we can send information about your orders.
The sending of information will be triggered as soon as your shipment undergoes a status update in our warehouses. You can select the events for which you wish to be alerted. This selection is made in the settings of the Cubyn API application.
Our systems will generate a POST request that will contain three main elements :
- The event on your shipment that triggered the request.
- Your API key
- Details of your parcel
The details of these different elements are available in the Webhook section of the Track parcels chapter accessible here.
Please note: we recommend that you provide us with a webhook URL in the HTTPs’ form and that you frequently compare your API key to the one that appears in the requests sent in order to make your system as secure as possible.
🚨 In order for wehbooks to be sent, the associated order must have been created through the same API connection. If the order was created manually, Wehbooks won't be sent.
Annexes
1- Attach a file to your shipment
In certain situations, you will need to attach a file to your shipment. In the Guide section, you will find the chapter Parcel attachment, accessible here, which tells you the query to be done to attach a file. This query will return a confirmation of the file attachment to your shipment.
2- Build the Cubyn Tracking Page
Cubyn offers a tracking page that is common to all carriers we interact with. We strongly recommend using it. To do so, you just have to create your tracking number and, with it, go to the tracking page. You will find the details of these steps here.
3- Ship with Cubyn Relay
In order to ship your parcels to a relay point, you need to specify the relayPickupRef. This corresponds to the location of the desired relay point, we recommend that you use our iframe to choose it. Currently working with Mondial Relais, you can still choose your relay point using their plugin.
For any further information on the integration, click here.
4- Test on Sandbox environment
Cubyn provides a Sandbox environment where you will be able to test your integration before going live. Ask your Cubyn Sales representative for a sandbox account.
For further information on the connection, click here.
Comments
0 comments
Article is closed for comments.