POST /api/v1/orders/create-items
Create Items
This endpoint is used to create items requested in an order to fulfill requirements based on capacity and availability, enabling the completion of delivery.
Request Body Structure
The request body must be in raw format and should include the parameters as described below.
Request Body Parameters
The request body should contain the following parameters:
Parameter Descriptions
- orderId (integer): The unique identifier for the order.
- orderNumber (string or null): The order number, if applicable. Can be
null
. - overProvision (boolean): Indicates whether over-provisioning is allowed for the items.
- items (array): An array of item objects, each containing:
- barcode (string): The unique barcode of the item.
- description (string): A description of the item.
- sourceReference (string): Internal reference for tracking the item.
- currenLocationName (string): The name of the current location where the item is stored.
- load (object): An object describing the load details, with the following fields:
- quantity (number): The quantity of the item.
- volume (number): The volume of the item.
- weight (number): The weight of the item.
- length (number): The length of the item.
- width (number): The width of the item.
- height (number): The height of the item.
- location (object): An object representing the geographical coordinates of the item’s location, with the following fields:
- latitude (number): The latitude of the location.
- longitude (number): The longitude of the location.
- itemLines (array): An array of item line objects, each containing:
- quantity (number): The quantity of this specific item line.
- description (string): A description of this item line.
- productReference (string): A reference to the product associated with this item line.
Example Request
POST /api/v1/orders/create-items
Content-Type: application/json
{
"orderId": 1,
"orderNumber": null,
"overProvision": false,
"items": [
{
"barcode": "000000000AABB",
"description": "Item Description",
"sourceReference": "Internal Reference",
"currenLocationName": "Sydney Warehouse",
"load": {
"quantity": 0,
"volume": 0,
"weight": 0,
"length": 0,
"width": 0,
"height": 0
},
"location": {
"latitude": 0,
"longitude": 0
},
"itemLines": [
{
"quantity": 4,
"description": "Bag of red apples",
"productReference": "PR-0000001"
},
{
"quantity": 7,
"description": "Bag of green apples",
"productReference": "PR-0000002"
}
]
},
{
"barcode": "000000000AACC",
"description": "Item Description",
"sourceReference": "Internal Reference",
"currenLocationName": "Canberra Warehouse",
"load": {
"quantity": 0,
"volume": 0,
"weight": 0,
"length": 0,
"width": 0,
"height": 0
},
"location": {
"latitude": 0,
"longitude": 0
},
"itemLines": [
{
"quantity": 4,
"description": "Bag of red apples",
"productReference": "PR-0000001"
}
]
}
]
}
Sample code
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com//api/v1/orders/create-items");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n \"orderId\": 229169,\r\n \"orderNumber\": null,\r\n \"overProvision\": true,\r\n \"items\": [\r\n {\r\n \"barcode\": \"000000000AABB\",\r\n \"description\": \"Item Description\",\r\n \"sourceReference\": \"Internal Reference\",\r\n \"currenLocationName\": \"Sydney Warehouse\",\r\n \"load\": \"{ quantity : 0, volume: 0, weight: 0, length : 0, width: 0, height: 0}\",\r\n \"location\": {\r\n \"latitude\": 0,\r\n \"longitude\": 0\r\n },\r\n \"itemLines\": [\r\n {\r\n \"quantity\": 4,\r\n \"description\": \"Bag of red apples\",\r\n \"productReference\": \"PR-000012\"\r\n }\r\n ]\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 \"orderId\": 229169,\r\n \"orderNumber\": null,\r\n \"overProvision\": true,\r\n \"items\": [\r\n {\r\n \"barcode\": \"000000000AABB\",\r\n \"description\": \"Item Description\",\r\n \"sourceReference\": \"Internal Reference\",\r\n \"currenLocationName\": \"Sydney Warehouse\",\r\n \"load\": \"{ quantity : 0, volume: 0, weight: 0, length : 0, width: 0, height: 0}\",\r\n \"location\": {\r\n \"latitude\": 0,\r\n \"longitude\": 0\r\n },\r\n \"itemLines\": [\r\n {\r\n \"quantity\": 4,\r\n \"description\": \"Bag of red apples\",\r\n \"productReference\": \"PR-000012\"\r\n }\r\n ]\r\n }\r\n ]\r\n}");
Request request = new Request.Builder()
.url("https://api.locate2u.com//api/v1/orders/create-items")
.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/orders/create-items',
'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({
"orderId": 229169,
"orderNumber": null,
"overProvision": true,
"items": [
{
"barcode": "000000000AABB",
"description": "Item Description",
"sourceReference": "Internal Reference",
"currenLocationName": "Sydney Warehouse",
"load": "{ quantity : 0, volume: 0, weight: 0, length : 0, width: 0, height: 0}",
"location": {
"latitude": 0,
"longitude": 0
},
"itemLines": [
{
"quantity": 4,
"description": "Bag of red apples",
"productReference": "PR-000012"
}
]
}
]
});
req.write(postData);
req.end();
'https://api.locate2u.com//api/v1/orders/create-items',
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 =>'{
"orderId": 229169,
"orderNumber": null,
"overProvision": true,
"items": [
{
"barcode": "000000000AABB",
"description": "Item Description",
"sourceReference": "Internal Reference",
"currenLocationName": "Sydney Warehouse",
"load": "{ quantity : 0, volume: 0, weight: 0, length : 0, width: 0, height: 0}",
"location": {
"latitude": 0,
"longitude": 0
},
"itemLines": [
{
"quantity": 4,
"description": "Bag of red apples",
"productReference": "PR-000012"
}
]
}
]
}',
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/orders/create-items"
payload = json.dumps({
"orderId": 229169,
"orderNumber": None,
"overProvision": True,
"items": [
{
"barcode": "000000000AABB",
"description": "Item Description",
"sourceReference": "Internal Reference",
"currenLocationName": "Sydney Warehouse",
"load": "{ quantity : 0, volume: 0, weight: 0, length : 0, width: 0, height: 0}",
"location": {
"latitude": 0,
"longitude": 0
},
"itemLines": [
{
"quantity": 4,
"description": "Bag of red apples",
"productReference": "PR-000012"
}
]
}
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer yourBearerTokenHere'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
Response
The API responds with a status code of 200 and a JSON object containing the following fields:
-
items
(array): An array of items with the following parameters:-
itemId
(integer): The ID of the item. -
barcode
(string): The barcode of the item. -
description
(string): The description of the item. -
itemLines
(array): An array of item lines with the following parameters:-
quantity
(integer): The quantity of the item line. -
description
(string): The description of the item line. -
productReference
(string): The product reference of the item line.
-
-
-
validationErrors
(array): An array of validation errors, if any.
Example response :
{
"items": [
{
"itemId": 5184553,
"barcode": "000000000AABB",
"description": "Item Description",
"itemLines": [
{
"quantity": 4.0,
"description": "Bag of red apples",
"productReference": "PR-000012"
}
]
}
],
"validationErrors": []
}