POST /api/v1/stops/{id}/change-status

This HTTP POST request is used to change the status of a stop with a specific ID. The request should be sent to https://api.locate2u.com/api/v1/stops/{stopid}/change-status

Input parameters:

id

The ID of the stop to update.

Example request body:

The request body should be in raw format and should include the following parameters:

  • oldStatus: (string) The previous status of the stop.
  • newStatus: (string) The new status to be assigned to the stop.

List of available statuses:

Pending

Enroute 

Arrived

Cancelled

Delayed 

Complete

On Hold

  • location: (object) An object containing the latitude and longitude of the stop’s location.
    • latitude: (number) The latitude of the stop’s location.
    • longitude: (number) The longitude of the stop’s location.
  • actionDate: (string) The date of the action.
{
  "oldStatus": "Pending",
  "newStatus": "Enroute",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "actionDate": "2024-03-04T09:20:20.918Z",
  "lines": [
    {
      "stopLineId": 101,
      "oldStatus": "Created",
      "newStatus": "Onboard",
      "location": {
        "latitude": -33.8706672,
        "longitude": 151.192487
      },
      "isManualEntry": true,
      "actionDate": "2024-03-04T09:20:20.918Z"
    }
  ]
}

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com/api/v1/stops/5176243/change-status");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n  \"oldStatus\": \"Pending\",\r\n  \"newStatus\": \"Enroute\",\r\n  \"location\": {\r\n    \"latitude\": -33.8706672,\r\n    \"longitude\": 151.192487\r\n  },\r\n  \"actionDate\": \"2024-01-29T09:37:07.526Z\"\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\",\r\n  \"location\": {\r\n    \"latitude\": -33.8706672,\r\n    \"longitude\": 151.192487\r\n  },\r\n  \"actionDate\": \"2024-01-29T09:37:07.526Z\"\r\n}");
Request request = new Request.Builder()
  .url("https://api.locate2u.com/api/v1/stops/5176243/change-status")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer yourBearerTokeHere")
  .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/stops/5176243/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",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "actionDate": "2024-01-29T09:37:07.526Z"
});


req.write(postData);


req.end();
 'https://api.locate2u.com/api/v1/stops/5176243/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",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "actionDate": "2024-01-29T09:37:07.526Z"
}',
  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/stops/5176243/change-status"


payload = json.dumps({
  "oldStatus": "Pending",
  "newStatus": "Enroute",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "actionDate": "2024-01-29T09:37:07.526Z"
})
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 response will have a status code of 200 and a Content-Type of text/xml.
Please note that the specific structure and content of the response data are not provided.

200 Success

401 Unauthorized

403 Forbidden