Update Deliveries via REST API
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
To enable/disable your deliveries via the REST API, first, you'll need to set up your API key. You can learn more about that HERE
Next, update the permissions on your REST API key. To enable or disable deliveries via the REST API, ensure the “Update” permission is selected under the Deliveries section in the permissions block.
Enable/disable deliveries
To submit a request, you will need to use the following URL (Also found on the REST API screen):
[PUT] https://{account}.leadbyte.com/restapi/v1.3/deliveries/{id}Remove {id} and replace it with the delivery ID. This can be found by checking the ID column on your delivery screen:
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"
}
]
}
Update delivery caps & revenue
Using the same URL and delivery ID process shown above, you can update the caps and revenue by including the additional request below.
{
"key": "API KEY HERE",
"update": {
"revenue": "4.00",
"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"
}
]
}
You can also combine both stats, cap and revenue update requests into one, as shown in the array below:
{
"key": "API KEY HERE",
"update": {
"status": "Active",
"revenue": "4.00",
"caps": {
"day": 3,
"week": 10,
"month": 30,
"total": 90
}
}
}
Comments