Update Deliveries via REST API
What you can get from this article
This article aims to explain the various actions you can perform to update your delivery via REST API.
This includes information such as -
- Enabling or disabling your delivery
- Adding, updating or removing caps to your delivery
The Basics
To enable/disable your deliveries via the REST API, first, you'll need to set up your API key.
Head to the Admin tab > Tech Hub > REST API to get started:
Step 1
Select Add new API Key and choose the type of key you need to update (Administrator for enabling/disabling deliveries)
Step 2
Set the permissions of the REST API key. For enabling and disabling deliveries via the REST API, you'll need to grant access to update deliveries.
Step 3
Ensure you activate this API key once set up; otherwise, it won't be classed as a valid key, and you won't be able to use it
Enabling and Disabling deliveries
Firstly, you will be using the below JSON request - URL:
[PUT] https://{account}.leadbyte.com/restapi/v1.3/deliveries/{id}
Remove {id} and replace this with the delivery ID. This can be found by checking the ID column on your delivery screen or by navigating to the relevant delivery and finding the FID in the URL.
Use the following body to change a delivery from "Inactive" to "Active"
{ "key": "API KEY HERE", "update": { "status": "Active" } }
Alternatively, use this body to change a delivery from "Active" to "Inactive"
{ "key": "API KEY HERE", "update": { "status": "Inactive" } }
You will then receive the following response if successful:
{ "status": "Success", "message": "OK", "deliveries": [ { "id": 825, "success": true, "message": "Delivery updated" } ] }
Or the below if the delivery is already active/inactive:
{ "status": "Warning", "message": "OK", "deliveries": [ { "id": 825, "success": false, "message": "Delivery already active" } ] }
Updating delivery caps
You'll be using most of the same information as the enable/disable request shown above
You will be using the below JSON request - URL:
[PUT] https://{account}.leadbyte.com/restapi/v1.3/deliveries/{id}
Remove {id} and replace this with the delivery ID. This can be found by checking the ID column on your delivery screen or by navigating to the relevant delivery and finding the FID in the URL.
{ "key": "API KEY HERE", "update": { "caps": { "day": 3, "week": 10, "month": 30, "total": 90 } } }
You will then receive the following response if successful:
{ "status": "Success", "message": "OK", "deliveries": [ { "id": 825, "success": true, "message": "Delivery updated" } ] }
Combo!
You can also combine the above 2 options into a single request by adding both caps AND status under the "update" array:
{ "key": "API KEY HERE", "update": { "status": "Active", "caps": { "day": 3, "week": 10, "month": 30, "total": 90 } } }
As always, if there are any further questions, raise a support ticket, and we'll be happy to help!
Comments