POST /api/v1/shipments/{id}/change-status
Update status of a shipment.
This endpoint is used to change the status of a shipment with a specific ID. The HTTP POST request should be made to https://api.locate2u.com/api/v1/shipments/{id}/change-status.
Input parameters:
id
id *required integer($int32) (path) Pass the ID of the shipment to update status.
Request Body
The request should include a JSON payload in the raw request body type with the following parameters:
- oldStatus (string): The previous status of the shipment.
- newStatus (string): The new status to be assigned to the shipment.
List of Shipment Statuses
Pending
Enroute to Pickup
Arrived at Pickup
Picked up
Enroute to Drop
Arrived at Drop
Complete
Cancelled
Delayed
On Hold - location (object): An object containing the latitude and longitude of the location.
- latitude (number): The latitude of the location.
- longitude (number): The longitude of the location.
- actionDate (string): The date of the action.
Example request body:
{
"oldStatus": "Pending",
"newStatus": "Enroute to Pickup",
"location": {
"latitude": -33.8706672,
"longitude": 151.192487
},
"actionDate": "2024-03-11T07:14:08.907Z"
}
Sample code
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com/api/v1/shipments/175368/change-status");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n \"oldStatus\": \"Pending\",\r\n \"newStatus\": \"Enroute to Pickup\",\r\n \"location\": {\r\n \"latitude\": -33.8706672,\r\n \"longitude\": 151.192487\r\n },\r\n \"actionDate\": \"2024-02-08T08:05:32.425Z\"\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"oldStatus\": \"Pending\",\r\n \"newStatus\": \"Enroute to Pickup\",\r\n \"location\": {\r\n \"latitude\": -33.8706672,\r\n \"longitude\": 151.192487\r\n },\r\n \"actionDate\": \"2024-02-08T08:05:32.425Z\"\r\n}");
Request request = new Request.Builder()
.url("https://api.locate2u.com/api/v1/shipments/175368/change-status")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer yourBearerTokenHere")
.build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.locate2u.com',
'path': '/api/v1/shipments/175368/change-status',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer yourBearerTokenHere'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"oldStatus": "Pending",
"newStatus": "Enroute to Pickup",
"location": {
"latitude": -33.8706672,
"longitude": 151.192487
},
"actionDate": "2024-02-08T08:05:32.425Z"
});
req.write(postData);
req.end();
'https://api.locate2u.com/api/v1/shipments/175368/change-status',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"oldStatus": "Pending",
"newStatus": "Enroute to Pickup",
"location": {
"latitude": -33.8706672,
"longitude": 151.192487
},
"actionDate": "2024-02-08T08:05:32.425Z"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer yourBearerTokenHere'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
import json
url = "https://api.locate2u.com/api/v1/shipments/175368/change-status"
payload = json.dumps({
"oldStatus": "Pending",
"newStatus": "Enroute to Pickup",
"location": {
"latitude": -33.8706672,
"longitude": 151.192487
},
"actionDate": "2024-02-08T08:05:32.425Z"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer yourBearerTokenHere'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
Upon successful execution, the endpoint returns a status code of 200 and the content type is ‘text/xml’. The response body is not provided (null).
200 OK