POST api/v1/items/create-shipment

Create Shipment Record for Items

This endpoint creates a shipment record in Locate2U for the specified item IDs, which were generated as part of an order received. For more details on shipments, please refer to here.

Request Body Structure

The request body must be in raw format and should include the parameters as described below.

Note: If the address parameter is not supplied, only a single shipment will be created for all item IDs provided in the array only if they belong to the same order. If the address is supplied, a single shipment will be created regardless of the orders to which the item IDs belong.

Request Body Parameters

The request body should contain the following parameters:

Only requires itemIds at least 1, e.g. "itemIds": [11234]

{
  "itemIds": [1, 2, 3, 4],
  "pickupAddress": "string",
  "dropAddress": "string",
  "pickupDate": "string",
  "dropDate": "string"
}

Parameter Descriptions

  • itemIds (array of integers): An array containing the unique identifiers of the items for which the shipment record is being created. Each ID corresponds to an item generated from a received order.
  • pickupAddress (string): The address where the items will be picked up. This should be a full address, including details like street, suite, city, state, and postal code.
  • dropAddress (string): The address where the items will be delivered. This should also be a full address with similar details as the pickup address.
  • pickupDate (string, ISO 8601 format): The date and time for the pickup, in ISO 8601 format (e.g., "2024-10-04T00:00:00.000Z").
  • dropDate (string, ISO 8601 format): The date and time for the drop-off, in ISO 8601 format (e.g., "2024-10-04T00:00:00.000Z").

Example Request

POST /api/v1/items/create-stop
Content-Type: application/json

{
  "itemIds": [1, 2, 3, 4],
  "pickupAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "dropAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "pickupDate": "2024-10-04T00:00:00.000Z",
  "dropDate": "2024-10-04T00:00:00.000Z"
}

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com//api/v1/items/create-shipment");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n  \"itemIds\": [\r\n    1,\r\n    2,\r\n    3,\r\n    4\r\n  ],\r\n  \"pickupAddress\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"dropAddress\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"pickupDate\": \"2024-10-04T00:00:00.000Z\",\r\n  \"dropDate\": \"2024-10-04T00:00:00.000Z\"\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  \"itemIds\": [\r\n    1,\r\n    2,\r\n    3,\r\n    4\r\n  ],\r\n  \"pickupAddress\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"dropAddress\": \"Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia\",\r\n  \"pickupDate\": \"2024-10-04T00:00:00.000Z\",\r\n  \"dropDate\": \"2024-10-04T00:00:00.000Z\"\r\n}");
Request request = new Request.Builder()
  .url("https://api.locate2u.com//api/v1/items/create-shipment")
  .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/items/create-shipment',
  '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({
  "itemIds": [
    1,
    2,
    3,
    4
  ],
  "pickupAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "dropAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "pickupDate": "2024-10-04T00:00:00.000Z",
  "dropDate": "2024-10-04T00:00:00.000Z"
});

req.write(postData);

req.end();
 'https://api.locate2u.com//api/v1/items/create-shipment',
  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 =>'{
  "itemIds": [
    1,
    2,
    3,
    4
  ],
  "pickupAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "dropAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "pickupDate": "2024-10-04T00:00:00.000Z",
  "dropDate": "2024-10-04T00:00:00.000Z"
}',
  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/items/create-shipment"

payload = json.dumps({
  "itemIds": [
    1,
    2,
    3,
    4
  ],
  "pickupAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "dropAddress": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
  "pickupDate": "2024-10-04T00:00:00.000Z",
  "dropDate": "2024-10-04T00:00:00.000Z"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer yourBearerTokenHere'
}

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

print(response.text)

Response

Example Response

The response from this endpoint includes details about the created shipment and any validation errors that may have occurred during the request.

Parameter Descriptions

  • validationErrors (array): An array containing any validation errors that occurred during the processing of the request. If no errors were found, this array will be empty.
  • stops (array): An array of stop objects, each containing:
    • stopId (integer): The unique identifier for the created stop.
    • stopRef (string): A reference identifier for the stop, which can be used for tracking or referencing the stop in future operations.
{
  "validationErrors": [],
  "shipments": [
    {
      "shipmentId": 32291,
      "shipmentRef": "LSS20240410T3460E"
    }
  ]
}