Add Stops

Creates a new stop.

This endpoint allows you to add stop for a trip.

*****Please note that it is strongly recommended to use this endpoint if you are wanting to push only a single stop into the Locate2u system. If you are looking to insert more than one stop (i.e. more than one stop or bulk import) you must use /api/v1/stops/import. You can find more details about import endpoint on the import api page. Using this import  endpoint to push through more than one stop in a go will save you from consuming a lot of your api calling limit and put less stress on our servers 🙂

Request Body (For detailed description of the fields you can refer to the put/update stop end point)

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

{
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "name": "Locate2u",
  "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "type": null,
  "appointmentTime": "12:00",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "brandId": null,
  "durationMinutes": 10,
  "notes": "Please call before you deliver",
  "tripDate": "2024-03-04T09:20:20.914Z",
  "customFields": {
    "custom1": "value",
    "custom2": "value",
    "custom3": "value"
  },
  "assignedTeamMemberId": "",
  "source": null,
  "sourceReference": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "customerId": 0,
  "runNumber": 0,
  "teamRegionId": 0,
  "contents": null,
  "driverInstructions": null,
  "lines": [
    {
      "barcode": "1234567890",
      "description": "Item A - Barcode scanning item",
      "currentLocation": "Warehouse",
      "serviceId": 0,
      "productVariantId": 0,
      "quantity": 1
    }
  ]
}
  • contact: Details of the contact person for the stop.
    • name: Name of the contact person.
    • phone: Phone number of the contact person.
    • email: Email of the contact person.
  • name: Name of the stop.
  • address: Address of the stop.
  • location: Geographical coordinates of the stop.
    • latitude: Latitude of the location.
    • longitude: Longitude of the location.
  • type: Type of the stop.
  • appointmentTime: Appointment time for the stop.
  • timeWindowStart: Start time of the time window for the stop.
  • timeWindowEnd: End time of the time window for the stop.
  • brandId: ID of the brand associated with the stop.
  • durationMinutes: Duration of the stop in minutes.
  • notes: Additional notes for the stop.
  • tripDate: Date of the trip.
  • customFields: Custom fields for the stop.
    • custom1: Custom field 1.
    • custom2: Custom field 2.
      custom3: Custom field 3.
  • assignedTeamMemberId: ID of the team member assigned to the stop.
  • source: Source of the stop.
  • sourceReference: Reference for the source of the stop.
  • load: Details of the load at the stop.
    • quantity: Quantity of the load.
    • volume: Volume of the load.
    • weight: Weight of the load.
    • length: Length of the load.
    • width: Width of the load.
    • height: Height of the load.
  • customerId: ID of the customer associated with the stop.
  • runNumber: Run number of the stop.
  • teamRegionId: ID of the team region associated with the stop.
  • contents: Contents at the stop.
  • driverInstructions: Instructions for the driver at the stop.
  • lines: Details of the lines at the stop.
    • barcode: Barcode of the line.
    • description: Description of the line.
    • currentLocation: Current location of the line.
    • serviceId: ID of the service associated with the line.
    • productVariantId: ID of the product variant associated with the line.
    • quantity: Quantity of the line.

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com/api/v1/stops/");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n  \"contact\": {\r\n    \"name\": \"Matthew Parker\",\r\n    \"phone\": \"0123456789\",\r\n    \"email\": \"matt.parker@email.com\"\r\n  },\r\n  \"name\": \"Locate2u\",\r\n  \"address\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"location\": {\r\n    \"latitude\": -33.8706672,\r\n    \"longitude\": 151.192487\r\n  },\r\n  \"type\": null,\r\n  \"appointmentTime\": \"12:00\",\r\n  \"timeWindowStart\": null,\r\n  \"timeWindowEnd\": null,\r\n  \"brandId\": null,\r\n  \"durationMinutes\": 10,\r\n  \"notes\": \"Please call before you deliver\",\r\n  \"tripDate\": \"2024-01-29T09:37:07.523Z\",\r\n  \"customFields\": {\r\n    \"custom1\": \"value\",\r\n    \"custom2\": \"value\",\r\n    \"custom3\": \"value\"\r\n  },\r\n  \"assignedTeamMemberId\": \"\",\r\n  \"source\": null,\r\n  \"sourceReference\": null,\r\n  \"load\": {\r\n    \"quantity\": 0,\r\n    \"volume\": 0,\r\n    \"weight\": 0,\r\n    \"length\": 0,\r\n    \"width\": 0,\r\n    \"height\": 0\r\n  },\r\n  \"runNumber\": 0,\r\n  \r\n  \"contents\": null,\r\n  \"driverInstructions\": null,\r\n  \"lines\": [\r\n    {\r\n      \"barcode\": \"1234567890\",\r\n      \"description\": \"Item A - Barcode scanning item\",\r\n      \"currentLocation\": \"Warehouse\",\r\n      \"serviceId\": 0,\r\n      \"productVariantId\": 0,\r\n      \"quantity\": 1\r\n    }\r\n  ]\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  \"contact\": {\r\n    \"name\": \"Matthew Parker\",\r\n    \"phone\": \"0123456789\",\r\n    \"email\": \"matt.parker@email.com\"\r\n  },\r\n  \"name\": \"Locate2u\",\r\n  \"address\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"location\": {\r\n    \"latitude\": -33.8706672,\r\n    \"longitude\": 151.192487\r\n  },\r\n  \"type\": null,\r\n  \"appointmentTime\": \"12:00\",\r\n  \"timeWindowStart\": null,\r\n  \"timeWindowEnd\": null,\r\n  \"brandId\": null,\r\n  \"durationMinutes\": 10,\r\n  \"notes\": \"Please call before you deliver\",\r\n  \"tripDate\": \"2024-01-29T09:37:07.523Z\",\r\n  \"customFields\": {\r\n    \"custom1\": \"value\",\r\n    \"custom2\": \"value\",\r\n    \"custom3\": \"value\"\r\n  },\r\n  \"assignedTeamMemberId\": \"\",\r\n  \"source\": null,\r\n  \"sourceReference\": null,\r\n  \"load\": {\r\n    \"quantity\": 0,\r\n    \"volume\": 0,\r\n    \"weight\": 0,\r\n    \"length\": 0,\r\n    \"width\": 0,\r\n    \"height\": 0\r\n  },\r\n  \"runNumber\": 0,\r\n  \r\n  \"contents\": null,\r\n  \"driverInstructions\": null,\r\n  \"lines\": [\r\n    {\r\n      \"barcode\": \"1234567890\",\r\n      \"description\": \"Item A - Barcode scanning item\",\r\n      \"currentLocation\": \"Warehouse\",\r\n      \"serviceId\": 0,\r\n      \"productVariantId\": 0,\r\n      \"quantity\": 1\r\n    }\r\n  ]\r\n}");
Request request = new Request.Builder()
  .url("https://api.locate2u.com/api/v1/stops/")
  .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/stops/',
  '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({
  "contact": {
    "name": "Matthew Parker",
    "phone": "0123456789",
    "email": "matt.parker@email.com"
  },
  "name": "Locate2u",
  "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "type": null,
  "appointmentTime": "12:00",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "brandId": null,
  "durationMinutes": 10,
  "notes": "Please call before you deliver",
  "tripDate": "2024-01-29T09:37:07.523Z",
  "customFields": {
    "custom1": "value",
    "custom2": "value",
    "custom3": "value"
  },
  "assignedTeamMemberId": "",
  "source": null,
  "sourceReference": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "runNumber": 0,
  "contents": null,
  "driverInstructions": null,
  "lines": [
    {
      "barcode": "1234567890",
      "description": "Item A - Barcode scanning item",
      "currentLocation": "Warehouse",
      "serviceId": 0,
      "productVariantId": 0,
      "quantity": 1
    }
  ]
});


req.write(postData);


req.end();
 'https://api.locate2u.com/api/v1/stops/',
  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 =>'{
  "contact": {
    "name": "Matthew Parker",
    "phone": "0123456789",
    "email": "matt.parker@email.com"
  },
  "name": "Locate2u",
  "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "type": null,
  "appointmentTime": "12:00",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "brandId": null,
  "durationMinutes": 10,
  "notes": "Please call before you deliver",
  "tripDate": "2024-01-29T09:37:07.523Z",
  "customFields": {
    "custom1": "value",
    "custom2": "value",
    "custom3": "value"
  },
  "assignedTeamMemberId": "",
  "source": null,
  "sourceReference": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "runNumber": 0,
 
  "contents": null,
  "driverInstructions": null,
  "lines": [
    {
      "barcode": "1234567890",
      "description": "Item A - Barcode scanning item",
      "currentLocation": "Warehouse",
      "serviceId": 0,
      "productVariantId": 0,
      "quantity": 1
    }
  ]
}',
  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/"


payload = json.dumps({
  "contact": {
    "name": "Matthew Parker",
    "phone": "0123456789",
    "email": "matt.parker@email.com"
  },
  "name": "Locate2u",
  "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "type": None,
  "appointmentTime": "12:00",
  "timeWindowStart": None,
  "timeWindowEnd": None,
  "brandId": None,
  "durationMinutes": 10,
  "notes": "Please call before you deliver",
  "tripDate": "2024-01-29T09:37:07.523Z",
  "customFields": {
    "custom1": "value",
    "custom2": "value",
    "custom3": "value"
  },
  "assignedTeamMemberId": "",
  "source": None,
  "sourceReference": None,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "runNumber": 0,
  "contents": None,
  "driverInstructions": None,
  "lines": [
    {
      "barcode": "1234567890",
      "description": "Item A - Barcode scanning item",
      "currentLocation": "Warehouse",
      "serviceId": 0,
      "productVariantId": 0,
      "quantity": 1
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer yourBearerTokenHere'
}


response = requests.request("POST", url, headers=headers, data=payload)


print(response.text)

Response

Example response will be something like below:
200 Success
Media type
application/json
Controls Accept header.
Example Value
Schema
{
  "assignedTo": {
    "id": "ee59-b174-4698-ac55-81d9d",
    "name": "John Doe"
  },
  "stopId": 164557,
  "status": "Pending",
  "brandId": null,
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "name": "Locate2u",
  "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "location": {
    "latitude": -33.8706672,
    "longitude": 151.192487
  },
  "tripDate": "2024-01-29",
  "appointmentTime": "09:37",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "durationMinutes": 10,
  "notes": "Please call before you deliver",
  "lastModifiedDate": "2024-01-29T09:37:07.523Z",
  "customFields": {
    "custom1": "value",
    "custom2": "value",
    "custom3": "value"
  },
  "type": null,
  "shipmentId": 0,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "source": null,
  "sourceReference": null,
  "customerId": 0,
  "runNumber": 0,
  "teamRegionId": 0,
  "teamMemberInvoiceId": 0,
  "customerInvoiceId": 0,
  "contents": null,
  "arrivalDate": "2024-01-29T09:37:07+00:00",
  "lines": [
    {
      "lineId": 201,
      "itemId": 101,
      "serviceId": null,
      "productVariantId": null,
      "barcode": "1234567890",
      "description": "Item A - Barcode scanning item",
      "quantity": 1,
      "status": "Created",
      "itemStatus": "",
      "unitPriceExTax": 0,
      "priceCurrency": ""
    }
  ],
  "driverInstructions": null,
  "oneTimePin": "0011"
}

201 Created
401 Unauthorized
403 Forbidden