POST /api/v1/orders

Create Orders

This endpoint allows you to create orders in the Locate2U system. It can accept multiple orders in a single request by providing an array of order objects, enabling efficient batch processing of orders.

Request Body Structure

The request body can contain a single order object with the required and optional parameters as described below.

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

Please note that the only required field for this request is:

OrderDate* (string)

The date of the order.

Request body parameters: This API endpoint allows you to create a new Order or orders by making an HTTP POST request to the specified URL. The request should include a payload in the raw request body type, containing details as mentioned below:

orderNumber (string): The order number.

purchaseOrderNumber (string): The purchase order number.

source (string): The source of the order.

sourceReference (string): The reference of the source.

sourceStatus (string): The status of the source.

status (string): The status of the order.

paymentStatus (string): The payment status of the order.

paymentDate (string): The date of payment.

customerId (integer): The ID of the customer.

brandId (integer): The ID of the brand.

contact (object): The contact information.

  • name (string): The name of the contact.
  • phone (string): The phone number of the contact.
  • email (string): The email of the contact.

pickupAddress (object): The pickup address information.

  • address (string): The address for pickup.
  • location (object): The coordinates of the pickup location.
    • latitude (number): The latitude of the pickup location.
    • longitude (number): The longitude of the pickup location.
  • name (string): The name of the pickup location.
  • line1 (string): The first line of the pickup address.
  • line2 (string): The second line of the pickup address.
  • city (string): The city of the pickup address.
  • province (string): The province of the pickup address.
  • provinceCode (string): The code of the province.
  • postcode (string): The postcode of the pickup address.
  • country (string): The country of the pickup address.
  • countryCode (string): The code of the country.

shippingAddress (object): The shipping address information (similar structure to pickupAddress).

orderDate (string): The date of the order.

expectedDeliveryDate (string): The expected delivery date.

timeWindowStart (string): The start time of the delivery window.

timeWindowEnd (string): The end time of the delivery window.

load (object): The load information.

  • quantity (number): The quantity of the load.
  • volume (number): The volume of the load.
  • weight (number): The weight of the load.
  • length (number): The length of the load.
  • width (number): The width of the load.
  • height (number): The height of the load.

deliveryInstructions (string): Instructions for delivery.

notes (string): Additional notes.

createStop (boolean): Indicates whether to create a stop.

contents (null): The contents of the order.

orderLines (array): An array of order line items.

  • productVariantId (null): The ID of the product variant.
  • quantity (number): The quantity of the product.
  • status (string): The status of the order line.
  • productReference (string): The reference of the product.
  • load (string): The load information.
  • createdDate (null): The date of creation.
  • createdByUserId (null): The ID of the user who created the order line.
  • lastModifiedDate (null): The date of the last modification.

Example request body:

{
  "orderNumber": "1423",
  "purchaseOrderNumber": "",
  "source": "Shopify",
  "sourceReference": "3852727623",
  "sourceStatus": "unfulfilled",
  "status": "Created",
  "paymentStatus": "Paid",
  "paymentDate": "2024-10-03T02:52:34.186Z",
  "customerId": null,
  "brandId": null,
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "pickupAddress": {
    "address": "102 George St, The Rocks NSW 2000, Australia",
    "location": {
      "latitude": -33.858314,
      "longitude": 151.209102
    },
    "name": "The Rocks",
    "line1": "102 George St",
    "line2": "",
    "city": "Sydney",
    "province": "New South Wales",
    "provinceCode": "NSW",
    "postcode": "2000",
    "country": "Australia",
    "countryCode": "AU"
  },
  "shippingAddress": {
    "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
    "location": {
      "latitude": -33.8706672,
      "longitude": 151.192487
    },
    "name": "55 Miller Street, Pyrmont, 2009, AU",
    "line1": "55 Miller Street",
    "line2": "",
    "city": "Pyrmont",
    "province": "Pyrmont New South Wales",
    "provinceCode": "NSW",
    "postcode": "2009",
    "country": "Australia",
    "countryCode": "AU"
  },
  "orderDate": "2024-10-03T02:52:34.186Z",
  "expectedDeliveryDate": "2024-10-03T02:52:34.186Z",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "deliveryInstructions": "Test delivery instructions",
  "notes": "Happy Notes",
  "createStop": true,
  "contents": null,
  "orderLines": [
    {
      "productVariantId": null,
      "quantity": 1,
      "status": null,
      "productReference": "PR-000012",
      "load": "{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}",
      "createdDate": null,
      "createdByUserId": null,
      "lastModifiedDate": null,
      "productVariant": null
    }
  ]
}

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com//api/v1/orders");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n  \"orderNumber\": \"1423\",\r\n  \"purchaseOrderNumber\": \"\",\r\n  \"source\": \"Shopify\",\r\n  \"sourceReference\": \"3852727623\",\r\n  \"sourceStatus\": \"unfulfilled\",\r\n  \"status\": \"Created\",\r\n  \"paymentStatus\": \"Paid\",\r\n  \"paymentDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"customerId\": null,\r\n  \"brandId\": null,\r\n  \"contact\": {\r\n    \"name\": \"Matthew Robinson\",\r\n    \"phone\": \"0123456789\",\r\n    \"email\": \"matt.robinson@email.com\"\r\n  },\r\n  \"pickupAddress\": {\r\n    \"address\": \"102 George St, The Rocks NSW 2000, Australia\",\r\n    \"location\": {\r\n      \"latitude\": -33.858314,\r\n      \"longitude\": 151.209102\r\n    },\r\n    \"name\": \"The Rocks\",\r\n    \"line1\": \"102 George St\",\r\n    \"line2\": \"\",\r\n    \"city\": \"Sydney\",\r\n    \"province\": \"New South Wales\",\r\n    \"provinceCode\": \"NSW\",\r\n    \"postcode\": \"2000\",\r\n    \"country\": \"Australia\",\r\n    \"countryCode\": \"AU\"\r\n  },\r\n  \"shippingAddress\": {\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    \"name\": \"55 Miller Street, Pyrmont, 2009, AU\",\r\n    \"line1\": \"55 Miller Street\",\r\n    \"line2\": \"\",\r\n    \"city\": \"Pyrmont\",\r\n    \"province\": \"Pyrmont New South Wales\",\r\n    \"provinceCode\": \"NSW\",\r\n    \"postcode\": \"2009\",\r\n    \"country\": \"Australia\",\r\n    \"countryCode\": \"AU\"\r\n  },\r\n  \"orderDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"expectedDeliveryDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"timeWindowStart\": null,\r\n  \"timeWindowEnd\": 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  \"deliveryInstructions\": \"Test delivery instructions\",\r\n  \"notes\": \"Happy Notes\",\r\n  \"createStop\": true,\r\n  \"contents\": null,\r\n  \"orderLines\": [\r\n    {\r\n      \"productVariantId\": null,\r\n      \"quantity\": 1,\r\n      \"status\": null,\r\n      \"productReference\": \"PR-000012\",\r\n      \"load\": \"{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}\",\r\n      \"createdDate\": null,\r\n      \"createdByUserId\": null,\r\n      \"lastModifiedDate\": null,\r\n      \"productVariant\": null\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  \"orderNumber\": \"1423\",\r\n  \"purchaseOrderNumber\": \"\",\r\n  \"source\": \"Shopify\",\r\n  \"sourceReference\": \"3852727623\",\r\n  \"sourceStatus\": \"unfulfilled\",\r\n  \"status\": \"Created\",\r\n  \"paymentStatus\": \"Paid\",\r\n  \"paymentDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"customerId\": null,\r\n  \"brandId\": null,\r\n  \"contact\": {\r\n    \"name\": \"Matthew Robinson\",\r\n    \"phone\": \"0123456789\",\r\n    \"email\": \"matt.robinson@email.com\"\r\n  },\r\n  \"pickupAddress\": {\r\n    \"address\": \"102 George St, The Rocks NSW 2000, Australia\",\r\n    \"location\": {\r\n      \"latitude\": -33.858314,\r\n      \"longitude\": 151.209102\r\n    },\r\n    \"name\": \"The Rocks\",\r\n    \"line1\": \"102 George St\",\r\n    \"line2\": \"\",\r\n    \"city\": \"Sydney\",\r\n    \"province\": \"New South Wales\",\r\n    \"provinceCode\": \"NSW\",\r\n    \"postcode\": \"2000\",\r\n    \"country\": \"Australia\",\r\n    \"countryCode\": \"AU\"\r\n  },\r\n  \"shippingAddress\": {\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    \"name\": \"55 Miller Street, Pyrmont, 2009, AU\",\r\n    \"line1\": \"55 Miller Street\",\r\n    \"line2\": \"\",\r\n    \"city\": \"Pyrmont\",\r\n    \"province\": \"Pyrmont New South Wales\",\r\n    \"provinceCode\": \"NSW\",\r\n    \"postcode\": \"2009\",\r\n    \"country\": \"Australia\",\r\n    \"countryCode\": \"AU\"\r\n  },\r\n  \"orderDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"expectedDeliveryDate\": \"2024-10-03T02:52:34.186Z\",\r\n  \"timeWindowStart\": null,\r\n  \"timeWindowEnd\": 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  \"deliveryInstructions\": \"Test delivery instructions\",\r\n  \"notes\": \"Happy Notes\",\r\n  \"createStop\": true,\r\n  \"contents\": null,\r\n  \"orderLines\": [\r\n    {\r\n      \"productVariantId\": null,\r\n      \"quantity\": 1,\r\n      \"status\": null,\r\n      \"productReference\": \"PR-000012\",\r\n      \"load\": \"{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}\",\r\n      \"createdDate\": null,\r\n      \"createdByUserId\": null,\r\n      \"lastModifiedDate\": null,\r\n      \"productVariant\": null\r\n    }\r\n  ]\r\n}");
Request request = new Request.Builder()
  .url("https://api.locate2u.com//api/v1/orders")
  .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',
  '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({
  "orderNumber": "1423",
  "purchaseOrderNumber": "",
  "source": "Shopify",
  "sourceReference": "3852727623",
  "sourceStatus": "unfulfilled",
  "status": "Created",
  "paymentStatus": "Paid",
  "paymentDate": "2024-10-03T02:52:34.186Z",
  "customerId": null,
  "brandId": null,
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "pickupAddress": {
    "address": "102 George St, The Rocks NSW 2000, Australia",
    "location": {
      "latitude": -33.858314,
      "longitude": 151.209102
    },
    "name": "The Rocks",
    "line1": "102 George St",
    "line2": "",
    "city": "Sydney",
    "province": "New South Wales",
    "provinceCode": "NSW",
    "postcode": "2000",
    "country": "Australia",
    "countryCode": "AU"
  },
  "shippingAddress": {
    "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
    "location": {
      "latitude": -33.8706672,
      "longitude": 151.192487
    },
    "name": "55 Miller Street, Pyrmont, 2009, AU",
    "line1": "55 Miller Street",
    "line2": "",
    "city": "Pyrmont",
    "province": "Pyrmont New South Wales",
    "provinceCode": "NSW",
    "postcode": "2009",
    "country": "Australia",
    "countryCode": "AU"
  },
  "orderDate": "2024-10-03T02:52:34.186Z",
  "expectedDeliveryDate": "2024-10-03T02:52:34.186Z",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "deliveryInstructions": "Test delivery instructions",
  "notes": "Happy Notes",
  "createStop": true,
  "contents": null,
  "orderLines": [
    {
      "productVariantId": null,
      "quantity": 1,
      "status": null,
      "productReference": "PR-000012",
      "load": "{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}",
      "createdDate": null,
      "createdByUserId": null,
      "lastModifiedDate": null,
      "productVariant": null
    }
  ]
});

req.write(postData);

req.end();
 'https://api.locate2u.com//api/v1/orders',
  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 =>'{
  "orderNumber": "1423",
  "purchaseOrderNumber": "",
  "source": "Shopify",
  "sourceReference": "3852727623",
  "sourceStatus": "unfulfilled",
  "status": "Created",
  "paymentStatus": "Paid",
  "paymentDate": "2024-10-03T02:52:34.186Z",
  "customerId": null,
  "brandId": null,
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "pickupAddress": {
    "address": "102 George St, The Rocks NSW 2000, Australia",
    "location": {
      "latitude": -33.858314,
      "longitude": 151.209102
    },
    "name": "The Rocks",
    "line1": "102 George St",
    "line2": "",
    "city": "Sydney",
    "province": "New South Wales",
    "provinceCode": "NSW",
    "postcode": "2000",
    "country": "Australia",
    "countryCode": "AU"
  },
  "shippingAddress": {
    "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
    "location": {
      "latitude": -33.8706672,
      "longitude": 151.192487
    },
    "name": "55 Miller Street, Pyrmont, 2009, AU",
    "line1": "55 Miller Street",
    "line2": "",
    "city": "Pyrmont",
    "province": "Pyrmont New South Wales",
    "provinceCode": "NSW",
    "postcode": "2009",
    "country": "Australia",
    "countryCode": "AU"
  },
  "orderDate": "2024-10-03T02:52:34.186Z",
  "expectedDeliveryDate": "2024-10-03T02:52:34.186Z",
  "timeWindowStart": null,
  "timeWindowEnd": null,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "deliveryInstructions": "Test delivery instructions",
  "notes": "Happy Notes",
  "createStop": true,
  "contents": null,
  "orderLines": [
    {
      "productVariantId": null,
      "quantity": 1,
      "status": null,
      "productReference": "PR-000012",
      "load": "{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}",
      "createdDate": null,
      "createdByUserId": null,
      "lastModifiedDate": null,
      "productVariant": null
    }
  ]
}',
  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"

payload = json.dumps({
  "orderNumber": "1423",
  "purchaseOrderNumber": "",
  "source": "Shopify",
  "sourceReference": "3852727623",
  "sourceStatus": "unfulfilled",
  "status": "Created",
  "paymentStatus": "Paid",
  "paymentDate": "2024-10-03T02:52:34.186Z",
  "customerId": None,
  "brandId": None,
  "contact": {
    "name": "Matthew Robinson",
    "phone": "0123456789",
    "email": "matt.robinson@email.com"
  },
  "pickupAddress": {
    "address": "102 George St, The Rocks NSW 2000, Australia",
    "location": {
      "latitude": -33.858314,
      "longitude": 151.209102
    },
    "name": "The Rocks",
    "line1": "102 George St",
    "line2": "",
    "city": "Sydney",
    "province": "New South Wales",
    "provinceCode": "NSW",
    "postcode": "2000",
    "country": "Australia",
    "countryCode": "AU"
  },
  "shippingAddress": {
    "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
    "location": {
      "latitude": -33.8706672,
      "longitude": 151.192487
    },
    "name": "55 Miller Street, Pyrmont, 2009, AU",
    "line1": "55 Miller Street",
    "line2": "",
    "city": "Pyrmont",
    "province": "Pyrmont New South Wales",
    "provinceCode": "NSW",
    "postcode": "2009",
    "country": "Australia",
    "countryCode": "AU"
  },
  "orderDate": "2024-10-03T02:52:34.186Z",
  "expectedDeliveryDate": "2024-10-03T02:52:34.186Z",
  "timeWindowStart": None,
  "timeWindowEnd": None,
  "load": {
    "quantity": 0,
    "volume": 0,
    "weight": 0,
    "length": 0,
    "width": 0,
    "height": 0
  },
  "deliveryInstructions": "Test delivery instructions",
  "notes": "Happy Notes",
  "createStop": True,
  "contents": None,
  "orderLines": [
    {
      "productVariantId": None,
      "quantity": 1,
      "status": None,
      "productReference": "PR-000012",
      "load": "{ quantity : 0, volume: 0, weight: 0,  length : 0, width: 0, height: 0}",
      "createdDate": None,
      "createdByUserId": None,
      "lastModifiedDate": None,
      "productVariant": None
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer yourBearerTokenHere'
}

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

print(response.text)

Response

Upon successful creation, the server responds with a status code of 201 and a JSON object containing the details of the newly created order.

  • orderId (number): The ID of the newly created order.
  • brandId (null): The ID of the brand.
  • orderNumber (string): The order number.
  • purchaseOrderNumber (string): The purchase order number.
  • source (string): The source of the order.
  • ... (other properties similar to the request body)

    Example response :

{
    "orderId": 229169,
    "brandId": null,
    "orderNumber": "1423",
    "purchaseOrderNumber": "",
    "source": "Shopify",
    "sourceReference": "3852727623",
    "sourceStatus": "unfulfilled",
    "status": "Created",
    "paymentStatus": "Paid",
    "paymentDate": "2024-10-03T02:52:34+00:00",
    "customerId": null,
    "contact": {
        "name": "Matthew Robinson",
        "phone": "0123456789",
        "email": "matt.robinson@email.com"
    },
    "pickupAddress": {
        "address": "102 George St, The Rocks NSW 2000, Australia",
        "location": {
            "latitude": -33.858314,
            "longitude": 151.209102
        },
        "name": "The Rocks",
        "line1": "102 George St",
        "line2": "",
        "city": "Sydney",
        "province": "New South Wales",
        "provinceCode": "NSW",
        "postcode": "2000",
        "country": "Australia",
        "countryCode": "AU"
    },
    "shippingAddress": {
        "address": "Level 4, Suite 4.11, 55 Miller St, Pyrmont NSW 2009, Australia",
        "location": {
            "latitude": -33.8706672,
            "longitude": 151.192487
        },
        "name": "55 Miller Street, Pyrmont, 2009, AU",
        "line1": "55 Miller Street",
        "line2": "",
        "city": "Pyrmont",
        "province": "Pyrmont New South Wales",
        "provinceCode": "NSW",
        "postcode": "2009",
        "country": "Australia",
        "countryCode": "AU"
    },
    "orderDate": "2024-10-03T02:52:34+00:00",
    "expectedDeliveryDate": "2024-10-03T00:00:00+05:30",
    "timeWindowStart": null,
    "timeWindowEnd": null,
    "load": {
        "quantity": 0,
        "volume": 0,
        "weight": 0,
        "length": 0,
        "width": 0,
        "height": 0
    },
    "customFields": {},
    "skills": [],
    "deliveryInstructions": "Test delivery instructions",
    "notes": "Happy Notes",
    "createdDate": "2024-10-03T06:52:07.253Z",
    "contents": null,
    "orderLines": [
        {
            "orderLineId": 61033,
            "orderId": 229169,
            "teamId": 34563,
            "productVariantId": null,
            "quantity": 1.0,
            "status": "Created",
            "productReference": "PR-000012",
            "load": {
                "quantity": 0,
                "volume": 0,
                "weight": 0,
                "length": 0,
                "width": 0,
                "height": 0
            },
            "createdDate": "2024-10-03T06:52:07.253Z",
            "createdByUserId": 31092,
            "lastModifiedDate": "2024-10-03T06:52:07.253Z"
        }
    ]
}