API guide

Overview

On the dot provides deliveries within a one hour timeslot of your customer’s choice. By integrating with our technology you can offer your customers a delivery window on the same day, next day or on a nominated day.

The APIs for On the dot created in the most popular programming languages are open and provide a simple interface. The APIs have been designed using RESTful architecture so that integration with your e-commerce website and/or your in-store EPOS systems is as easy as possible.

Our API platform is designed to allow you to receive and display dynamic timeslot availability and pricing. Customers choose their preferred timeslot; track the delivery from store to door, and also receive email notifications at every step. To get you started, we provide you with an API key (generated using user subscription flow) that allows you to use our sample code to integrate On the dot directly into your chosen environment.

Before you begin

The API created by “On the dot” makes integration easy. With two simple API calls, you can quickly make a booking for your customers.

To get started with using the On the dot API:

1 Sign-up with “On the dot” API store; create new application and subscribe to all the essential APIs. (see user subscription flow section)

2 Call the API as per specification using the API-key which is unique for every application per retailer.

3 Read “On the dot” API documentation.

Signing up

As a developer sign up for a developer account at https://sbstore.onthedot.com/store

1 Sign up for a developer account

2 After sign-up, log into your developer account.

3 In the home page, click My applications from the menu bar.

4 In the Add New Application section:

  1. Enter name for the application, callback URL and description
  2. Choose the throttling tier from the drop-down menu
  3. Click Add

Subscribing to APIs

1Click APIs tab on the menu bar

2In the APIs tab, select an API

3In the page of the API you selected, select the Application and the Tier to be associated with the API and click Subscribe

4In the right panel, select the Application and the Tier to be associated with the API and click Subscribe

5In the Subscription Successful dialogue box, click Go to My Subscription or Stay on this page

Note that the details of the added application appear in the Applications page.

Generating access tokens

1Click My Subscriptions tab in the menu bar

2In the Subscriptions page,

  1. Next to the Applications with Subscriptions field, select the application from the dropdown menu
  2. Click Generate in the Keys – Production section or Key – Sandbox section

At this point you will be provided with a default storeId. You can now use this storeId to place bookings orders. Since this is a test store and is a shared tenant any booking made will be visible to other users too.

Seed data

Default Values
Account W99969
Service Centre WO-SD
Service Y2
Postcode EC2A4PH
Latitude 51.5233512
Longitude -0.08101320000002943

Destination Postcodes in relation with the stores Postcodes below assume EC2A 4PH as centre.

In Zone - Postcodes within 0-5 mile radius
Postcode Km Miles
SW1P 4ES 4.71 2.93
SW1P 4JH 4.71 2.93
SW1P 4JQ 4.71 2.93
W1A 1EF 4.71 2.93
W1C 1JG 4.71 2.93
W1C 2AH 4.72 2.93
SW1P 4ES 4.71 2.93
Ad hoc - Postcodes within 5-10 mile radius
Postcode Km Miles
SE6 4RS 10.59 6.58
BR3 3PB 13.9 8.64
EN3 7DB 14.22 8.84
SE6 4EW 10.01 6.22
E9 5RJ 4.2 2.61
Out of Zone - Postcodes outside the 10 mile radius
Postcode Km Miles
W7 3UF 18 11.19
TW7 4JF 18.64 11.59
TW7 6JT 18.82 11.7
HA1 3HD 18.56 11.53
HA1 1QA 19.07 11.85

N.B. Please use FreeMapTools to obtain postcodes for the other stores

Api standards

Currently, all the APIs are JSON-based APIs. They support standard HTTP verbs, for example, GET, POST, PUT and DELETE. The current API does not support PATCH HTTP verb.

Resource URL Format

{URI-Schema}/domain/version/resource_type/[sub-resource|identifiers]?query_string
                            Example call with API key passed in the request header:
    
    https://api.onthedot.co.uk/service/v1.0//{:id}//{:id}
    https://api.onthedot.co.uk/utility/v1.0//
    
                                                    

Methods supported

Method Description
GET Retrieve record or collection of records
POST Creating new record
PUT Update the existing record
DELETE Delete the record

API category

The category of the API is decided based on its usability. The following categories are supported:

Type Description
Service APIs which encapsulate business logic and initiate services on behalf of consumers
Utility APIs which encapsulate utility-type functionality, i.e. meta data

HTTP Codes

All the APIs return HTTP code in response to various error scenarios:

HTTP Codes Status Description
200 Success Request completed as expected
201 Created Entity created
301 Moved permanently Service permanently redirected
304 Not modified If request is cached and not updated
400 Bad request Request payload is not as per specification, i.e. argument or parameter is missing
401 Unauthorized Authorization token unavailable or not valid
403 Forbidden Server understood the request but refusing to fulfil the request.
Example: Access not allowed based on Access Control List, tier restriction, etc.
404 Not found Not found anything matching the Request-URI (Uniform Resource Identifier)
405 Method not allowed Method is not supported or not allowed
406 Not Accepted The Accept header in the request asking for format which is not supported
409 Conflict Concurrent update to the same entity
413 Request entity too large Over the allowed limit
500 Internal server error Server encountered an unexpected error
503 Service unavailable Service is unable to handle the request due to temporary overloading or maintenance of the server

Request format

Currently, API supports only JSON-based requests. The API-key is mandatory for all the requests as part of header.

Header definition

Definition of the request headers is as follows:

Note: (M)andatory, (O)ptional
Field Type Required Valid Description
Accept String O JSON Currently, first version of API only supports JSON response and does not support any other formats i.e. XML
Channel String O To be the identifier for application business unit i.e. ecomm, mcomm. By default, ecomm
Authorization String M Bearer i.e. Bea Accepts the valid API-key in the provided format that was created during the user subscription process
x-client-trans-id String O Unique identifier passed by client application which is used to track the internal application flow
Query definition

Depending on the requirement of the API, the response of the API will include the following fields:

Fields Type Valid values Description
meta Boolean true/false,
By default ‘false’
Whether to return meta information of the response or not. By default ‘false’ until specified as part of API specification
filter Strings
(separated by comma)
Filters the response based on the object types.
Note: Not supported in the first release of the API
locale String Two character ISO representation of language. Default ‘en’ Language of the API response. Currently, supports only ‘en’
how many Numeric How many records in a single page (See pagination section)
page number Numeric Page offset i.e. page number (See pagination section)
no-links Boolean true/false Whether to return links of the valid, associated actions with the current request (HATEOS implementation).
Note: Not supported in the first release of the API

Response format

All the API's support the following specification:

Header definition
Field Type Valid values Description
Content-Type String   Currently, only supported content type is ‘application/json’ only
Content-Length Numeric   Response content length
x-client-trans-id String   Unique identifier passed by the client application which is used to track the internal client application flow
x-response-trans-id Numeric   Uniquely identify the transactions in the API platform against the client request
date Date   Current date in ISO 8601 format
Response definition

Depending on the requirement of the API, the response of the API will include the following fields:

Fields Description
meta Meta data about the response, i.e. count of records (if more records are based on the requested inputs), updated or created date for the record
data Response object in the form of JSON (it contains all the data from the request)
success Returns status ‘ok’ in case of a successful response
error Collection of the errors with error codes and error messages
    Example call with API key passed in the request header:
    
    {
        "meta": {
            //meta information related with response i.e.
            //created_at,
            //updated_at,
            //totalCount,
        },
        "data": {
            //Response object in JSON format along with request data
        },
        "success": {
            "status":"ok"
        },
        "errors": {
            //collection of all the errors
            “error”:{
                “errorCode”:”code”
                “message”:”error message”
            }
        },
        "links": {
            //to support the related resources with the requested resource
            “link”:{
            “ref”:“Self”,
            “type”:””,
            “link”:” Link_URL”,
            “request_type”:””,
            “response_type”:””
        }
    }
    
                                                                

Date and time

The date and time object used in the request or response supports ISO8601 format and will be reported in UTC time for example, “2015-08-15T10:04:02.000Z”.

Supported characters

On the dot accepts alpha numeric characters as well as these special characters ~`! @#$^&*()_+=-:;',.?/| in the fields for instructions, address and item descriptions.

Pagination

Large data response from the API is restricted to a maximum of 500 records to reduce band-width usage.The pagination of the records can be achieved by providing the query parameters 'how many' and 'page number' in the request format of supported APIs. If the provided query parameters exceed 500 records then the record size is restricted to 500 to avoid huge data in response.

Examples: Pagination can be done in two ways

1Retrieving the number of records as per choice

Example:

Retrieve 300 recent records. In that case, using ‘how many’ query parameter is sufficient with 300. Output of the API would be 300 recent records.

2Requesting records for a specific page number when client application provides pagination with different ‘filter’ criteria.

Example:

Fetching booking orders by storeid when client application shows only 20 records in a page. In that case, for fetching the record for 2 pages, API expects how many would be ‘20’ and page number would be ‘2’. In that case, the records from 21st - 40th, based on the filter criteria, will be fetched by the API.

Currency

All the currencies used in the request and response, by default, are considered to be in Pounds. Future versions of the API will support multiple currencies.

Security

All the APIs are exposed only over SSL (HTTPs).On the dot supports TLS version 1.1 and above.

API-key, generated during the API subscription process (see API integration process section) is critical to access the API. The API key will be used by the API platform to identify the customer or retailer. Best practice should be followed for securely keeping the API-key in the application or while transferring.

Extra care should be taken while keeping the API-key at the client-side so that it is not accessed by unauthorized users.

Webhook Events

Webhooks are the end-points exposed by Retailers to Accept the status change updates about the delivery at real-time from the API platform. This is to facilitate retailers to update their customers about the status of their delivery on the portal.

The status sent to the end-points as part of the updates are as follows:

  • Booked
  • Allocated to Driver
  • Driver at the Store
  • Parcels Collected
  • Arriving soon
  • Driver at the Delivery
  • Delivered
  • Cancelled

The specification of the message sent via REST POST method as part of the notification is provided in the sample webhook payload.

Note: orderInfo/deliveryNumber contains the departmentReferenceNo of booking.

    Sample of Webhook payload:
    
    {
        "carrierCode": {
            "uuid": "2595ed3f-07de-4073-b758-6eeda58e40d0",
            "isoLang": "",
            "locale": "",
            "timezone": ""
        },
        "event": {
            "eventId": "-",
            "eventTimestamp": "2016-1-26T7:28:47Z"
        },
        "orderInfo": {
            "orderNumber": "17448554",
            "deliveryNumber": "017448554601",
            "shipmentNumber": ""
        },
        "tracking": {
            "trackingID": "-",
            "pickupETA": "2016-02-26T07:48:00.000+0000",
            "deliveryETA": "-",
            "deliveryDeadline": "-",
            "deliveryComplete": "N",
            "deliveryStatus": "Allocated to Driver",
            "reasonCode": "",
            "reasonText": ""
        },
        "pickup": {
            "storeId": "NEW-GRAYS-RM202ZP_1",
            "pickupName": "Apple - Grays",
            "pickupStreetNo": "WEST THURROCK WAY",
            "pickupStreet": "LAKESIDE SHOPPING CENTRE",
            "pickupDistrict": "-",
            "pickupCity": "GRAYS",
            "pickupState": "",
            "pickupPostalCode": "RM20 2ZP",
            "pickupCountryCode": "26",
            "pickupPhoneNo": "7777777779",
            "pickupBusiness": "Apple - Grays",
            "pickupLat": "51.581163",
            "pickupLong": "51.581163"
        },
        "shipto": {
            "shiptoFirstName": "test",
            "shiptoLastName": "",
            "shiptoStreetNo": "testaddress",
            "shiptoStreet": "address2",
            "shiptoDistrict": "-",
            "shiptoCity": "London",
            "shiptoState": "-",
            "shiptoPostalCode": "RM202ZP",
            "shiptoCountryCode": "",
            "shiptoLat": "-",
            "shiptoLong": "-"
        },
        "courier": {
            "courierName": "-",
            "courierPhone": "-",
            "courierEmail": "",
            "courierLat": "-",
            "courierLong": "-",
            "courierPhotoURL": ""
        },
        "vehicle": {
            "vehicleType": "-",
            "licensePlate": "",
            "vehicleMake": "",
            "vehicleModel": ""
        },
        "deliveryPOD": {
            "recipientName": "",
            "customerSigURL": ""
        },
        "relatedItems": {},
        "timestamp": {
            "deliveredTimestamp": "",
            "createdTimestamp": "2016-1-26T7:4:10Z",
            "updatedTimestamp": "2016-1-26T7:4:56Z"
        }
    }
    
                                                                

API samples

Create new store

This API used to Create a new store

Resource properties
Resource URL
https://<domain-name>/service/v1/stores/
HTTP Method POST
Resource type Record
Response entity type store
Response format JSON
Request
Query parameters
no-links Not supported1
filter Not supported1
how many Not supported1
meta Not supported1
locale Optional, default is ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
Channel Required
x-client-request-id Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Request fields
Name Entity Type Required Description
store
storeId Alphanumeric Optional The unique id for the store which retailer wants to create ,if not supplied it will be auto-generated
retailerName String Mandatory

min length:1
max length:30
Retailer name
imageUrl URL Optional image\logo path of Store
timeslotDuration Numeric Optional

min length:1
max length:24
The default duration of timeslot configured at store level which will be used for delivery window.If not specified default value is 1 hour.
isDrivenMileage String Optional Valid entry will be "Y" or "N". Which will determine distance calculation is based on driven mileage or Crow Flies depending on commercials agreed.
address Store\address
firstLine String Mandatory

min length:1
max length:60
First address line of store
secondLine String Optional

max length:60
Second address line of store
city String Mandatory

max length:60
City where store is located
state String Optional State where store is located
postCode String Mandatory

min length:1
max length:20
Postcode
country String Optional Country where store is located
info Store\info
storeName String Mandatory

min length:1
max length:30
Store\Branch Name
mobileNumber String Optional

min length:10
max length:13
mobile number which belongs to store.Eg:(0)7XXXXXXXXX
businessPhoneNumber String Mandatory

min length:1
max length:32
Contact phone number of store
website String Optional Store website
storeDesc String Mandatory

min length:1
max length:250
Description of the store
userName String Mandatory

max length:80
Email address of the store to be registered
branchEmail String Optional

max length:80
Email address of store
branchInStoreTime Integer Optional

Ex:20,30
Time spent at store when collecting the packages. By default this is 30 minutes
collectionLeadTime Integer Optional

Ex:20,30
Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Mandatory Service center code for the store
service String Optional Service associated with account
accountType String Optional By default account type is "credit"
accountNumber String Mandatory

max length:9
By default use "W99969" for store creation or use the one that has been supplied by CitySprint/On the dot.
openTime String Optional

Ex:"10:00","18:30"
Store open time on the booking date
closeTime String Optional

Ex:"10:00","18:30"
Store closing time on the booking date
openingHours Map<String, String> Mandatory Store open and close times for an entire week
bankHolidayDetails Map<String, String> Mandatory Bank holidays of the store
location location
lat String Mandatory

Ex:"51.5574352" ,"-0.092058"
Latitude of the store
lng String Mandatory

Ex:"51.5574352" ,"-0.092058"
Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String Optional

max length:0
max length:1
0(NO) and 1(YES)
storeType String Optional

max length:0
max length:3
[1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Optional

max length:0
max length:2
Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String Optional

max length:0
max length:1
0(NO) and 1(YES)
instruction String Optional Store instruction
Note: (M)andatory, (O)ptional
Response
Response Headers
Content-Type Optional
Content-Length Optional
x-client-trans-id Optional
Date Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response fields
Name Type Description
storeId String This can be either the store_id that has been supplied by us or supplied by the retailer
retailerName String Retailer name
imageUrl URL image\logo path of store
timeslotDuration Numeric Default timeslot duration of store
isDrivenMileage String Distance calculation configuration.
address Store\address
firstLine String Retailer first address line
secondLine String Retailer second address line
city String Retailer city
state String State where store resides
postCode String Retailer postcode
country String Retailer country
info Store\info
storeName String Store\Branch Name
mobileNumber String mobile number which belongs to store
businessPhoneNumber String Contact phone number of store
website String Store website
storeDesc String Description of the store
userName String Username of retailer with which stored has been registered
branchEmail String Email address of store
branchInStoreTime Integer Time spent at store for collecting the packages by default 30 minutes
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is null
serviceCenterCode String Service center code for the store. By default this is null
accountType String Account type credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Store open time on the booking date
closeTime String Store closing time on the booking date
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location location
lat String Latitude of the store
lng String Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
Exceptions and Error codes
Exceptions
Status Error Code HTTP Code Description
Success 201 Resource created
Error BAD_REQUEST 400 BAD Request
Error STORE_RECORD_EXISTS 400 Store Record already exists
Generic Error
Error UNAUTHORIZED 401 Unauthorized, API key is not valid
Error QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error INTERNAL_SERVER_ERROR 500 Internal server error
Error SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                                    
	curl -X POST https://legacy-api.onthedot.com/api/v1.0/stores/ --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json" -d "{\"storeId\":\"1\",\"retailerName\":\"CitySprint\",\"imageUrl\":\"\", \"maxmiles\": 10,\"minmiles\": 0,\"timeslotDuration\": 1,\"address\":{\"firstLine\":\"line1\",\"secondLine\":\"line2\",\"city\":\"Town C\",\"state\":\"null\",\"postCode\":\"HA11JU\",\"country\":\"United\"},\"info\":{\"storeName\":\"UAT003\",\"mobileNumber\":\"7777777777\",\"businessPhoneNumber\":\"7777777777\",\"website\":\"www.hello.com\",\"storeDesc\":\"A well known bran\",\"userName\":\"xyz@citysprint.co.uk\",\"branchEmail\":\"xyzstore@mail.com\",\"branchInStoreTime\":\"30\",\"collectionLeadTime\":\"null\",\"serviceCenterCode\":\"WO-SD\",\"accountType\":\"Credit\",\"accountNumber\":\"W99969\",\"openTime\":\"null\",\"closeTime\":\"null\",\"openingHours\":{\"MON\":\"11:00 - 18:00\",\"TUE\":\"11:00 - 18:00\",\"WED\":\"11:00 - 18:00\",\"THU\":\"11:00 - 18:00\",\"FRI\":\"11:00 - 18:00\",\"SAT\":\"11:00 - 18:00\",\"SUN\":\"Closed\"},\"bankHolidayDetails\":{\"New Years Day\":\"12:00 - 17:00\",\"Good Friday\":\"Closed\",\"Easter Sunday\":\"12:00 - 17:00\",\"Easter Monday\":\"12:00 - 17:00\",\"Early May Bank Holiday\":\"12:00 - 17:00\",\"Summer Bank Holiday\":\"12:00 - 17:00\",\"Christmas Day\":\"12:00 - 17:00\",\"Boxing Day\":\"12:00 - 17:00\"},\"service\":\"\"},\"location\":{\"lat\":\"51.581163\",\"lng\":\"51.581163\"},\"knowMore\":{\"likeToBePartnerRetailer\":\"1\",\"storeType\":\"1\","havePortal\":\"1\","shippingDetail\":\"0\","instruction\":\"null\"}}
                                                    
                                                                                
                                                    
   {
	"data": {
    "storeId": "DEV002",
    "retailerName": "Xyz store",
    "imageUrl": "",
	"maxmiles": 10,
    "minmiles": 0,
	"timeslotDuration": 1,
    "address": {
      "firstLine": "1 Regent Street",
      "secondLine": "Street B",
      "city": "Town C",
      "state": null,
      "postCode": "HA11JU",
      "country": "United Kingdom"
    },
    "info": {
      "storeName": "Xyz store",
      "mobileNumber": "7777777777",
      "businessPhoneNumber": "7777777777",
      "website": "www.hello.com",
      "storeDesc": "A well known brand1",
      "userName": "xyz@citysprint.co.uk",
      "branchEmail": "xyzstore@mail.com",
      "branchInStoreTime": 30,
      "collectionLeadTime": null,
      "serviceCenterCode": "WO-SD",
      "accountType": "credit",
      "accountNumber": "W99969",
      "openTime": null,
      "closeTime": null,
      "openingHours": {
        "MON": "11:00 - 18:00",
        "TUE": "11:00 - 18:00",
        "WED": "11:00 - 18:00",
        "THU": "11:00 - 18:00",
        "FRI": "11:00 - 18:00",
        "SAT": "11:00 - 18:00",
        "SUN": "Closed"
      },
      "bankHolidayDetails": {
        "New Years Day": "12:00 - 17:00",
        "Good Friday": "Closed",
        "Easter Sunday": "12:00 - 17:00",
        "Easter Monday": "12:00 - 17:00",
        "Early May Bank Holiday": "12:00 - 17:00",
        "Summer Bank Holiday": "12:00 - 17:00",
        "Christmas Day": "12:00 - 17:00",
        "Boxing Day ": "12:00 - 17:00"
      },
      "service": "Y1"
    },
    "location": {
      "lat": "51.581163",
      "lng": "51.581163"
    },
    "knowMore": {
      "likeToBePartnerRetailer": 1,
      "storeType": 2,
      "havePortal": 1,
      "shippingDetail": 0,
      "instruction": null
    }
	"isDrivenMileage":null
  },
  "success": {
    "status": "OK"
  }
}
                                                    
                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/stores');
    //create storeId
    define('STORE_ID', "1234567");
    //Create Store Payload
    $data = array(
            "storeId"=> STORE_ID,
            "retailerName"=> "Xyz store",
            "imageUrl"=> "",
			"maxmiles"=> 10,
			"minmiles"=> 0,
			"timeslotDuration"=> 1,
            "address"=> array(
                "firstLine"=> "Street 1",
                "secondLine"=> "Street B",
                "city"=> "Town C",
                "state"=> null,
                "postCode"=> "HA11JU",
                "country"=> null
            ),
            "info"=> array(
                "storeName"=>"Xyz store",
                "mobileNumber"=>"7777777777",
                "businessPhoneNumber"=>"7777777777",
                "website"=>"www.hello.com",
                "storeDesc"=>"A well known brand1",
                "userName"=>"xyz@citysprint.co.uk",
                "branchEmail"=>"xyzstore@mail.com",
                "branchInStoreTime"=>30,
                "collectionLeadTime"=>null,
                "serviceCenterCode"=>"WO-SD",
                "accountType"=>"credit",
                "accountNumber"=>"W99969",
                "openTime"=>null,
                "closeTime"=>null,
                "openingHours"=> array(
                     "MON"=>"11:00 - 18:00",
                     "TUE"=>"11:00 - 18:00",
                     "WED"=>"11:00 - 18:00",
                     "THU"=>"11:00 - 18:00",
                     "FRI"=>"11:00 - 18:00",
                     "SAT"=>"11:00 - 18:00",
                     "SUN"=>"Closed"
                ),
                "bankHolidayDetails"=> array(
                    "Boxing Day"=> "12:00 - 17:00",
                    "Christmas Day"=> "12:00 - 17:00",
                    "Early May Bank Holiday"=> "12:00 - 17:00",
                    "Easter Monday"=> "12:00 - 17:00",
                    "Easter Sunday"=> "12:00 - 17:00",
                    "Good Friday"=> "Closed",
                    "New Years Day"=> "12:00 - 17:00",
                    "Summer Bank Holiday"=> "12:00 - 17:00"
                ),
                "service"=>"Y2"
            ),
            "location"=> array(
                "lat"=> "51.581163",
                "lng"=> "51.581163"
            ),
            "knowMore"=> array(
                "likeToBePartnerRetailer"=> 1,
                "storeType"=> 1,
                "havePortal"=> 1,
                "shippingDetail"=> 0,
                "instruction"=>null
            )
    );
    //Get Booking API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json"
    );
    /**
     * Call to Create Store API
     * @param array $data
     * @param array $headers
     * @return string json response
     */
    function createStore(array $data,array $headers) {
        $ch = curl_init(API_URL);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call createStore
    $response = createStore($data, $headers);
    //API response
    if(is_array($response)){
        echo print_r($response);
    }else{
        echo $response;
    }
                                                    
                                                                                
                                                    
    {
       "data":{
          "storeId":"1234567",
          "retailerName":"Xyz store",
		  "timeslotDuration": 1,
          "imageUrl":"",
          "address":{
             "firstLine":"Street 1",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":null,
             "closeTime":null,
             "openingHours":{
                "MON":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00",
                "THU":"11:00 - 18:00",
                "FRI":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed"
             },
             "bankHolidayDetails":{
                "New Years Day":"12:00 - 17:00",
                "Good Friday":"Closed",
                "Easter Sunday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Boxing Day":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
		   "isDrivenMileage":null
       },
       "success":{
          "status":"OK"
       }
    }
                                                    
                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to create a store and get store details from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Store { /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String STORE_URLSUFFIX="/api/v1.0/stores/"; private static final int SUCCESS=200; private static final int CREATED=201; public static void main(String[] args) throws IOException { //Create store createStore(); } private static void createStore() { try { System.out.println("------------------- Store#createStore----------"); //load the Store payload //make sure that you use unique storeId always when creating store //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/post-store-body.json and keep it in classpath InputStream fileInputStream = Store.class.getClassLoader().getResourceAsStream("create-store.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); //Read the post store url from config file URL url = getUrl(STORE_URLSUFFIX); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //It is a HTTP POST Call. connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type",contentType); connection.setRequestProperty("Content-Length",fileContent.length() + ""); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); DataOutputStream outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var userData = {
		"storeId": "dd8aaac3-f432-4286-a916-3137c8a079c9",
		"retailerName": "Xyz store",
		"imageUrl": "",
		"timeslotDuration": 1,
		"address": {
			"firstLine": "1 Rama Apartments",
			"secondLine": "17 St. Anns Road",
			"city": "Town C",
			"state": null,
			"postCode": "HA1 1JU",
			"country": null
		},
		"info": {
			"storeName": "Xyz store",
			"mobileNumber": "7777777777",
			"businessPhoneNumber": "7777777777",
			"website": "www.hello.com",
			"storeDesc": "A well known brand1",
			"userName": "xyz@citysprint.co.uk",
			"branchEmail": "xyzstore@mail.com",
			"branchInStoreTime": 30,
			"collectionLeadTime": null,
			"serviceCenterCode": "WO-SD",
			"accountType": "credit",
			"accountNumber": "W99969",
			"openTime": null,
			"closeTime": null,
			"openingHours": {
				"MON": "11:00 - 18:00",
				"TUE": "11:00 - 18:00",
				"WED": "11:00 - 18:00",
				"THU": "11:00 - 18:00",
				"FRI": "11:00 - 18:00",
				"SAT": "11:00 - 18:00",
				"SUN": "Closed"
			},
			"bankHolidayDetails": {
				"New Years Day": "12:00 - 17:00",
				"Good Friday": "Closed",
				"Easter Sunday": "12:00 - 17:00",
				"Easter Monday": "12:00 - 17:00",
				"Early May Bank Holiday": "12:00 - 17:00",
				"Summer Bank Holiday": "12:00 - 17:00",
				"Christmas Day": "12:00 - 17:00",
				"Boxing Day ": "12:00 - 17:00"
			},
			"service": "Y0"
		},
		"location": {
			"lat": "51.581163",
			"lng": "51.581163"
		},
		"knowMore": {
			"likeToBePartnerRetailer": 1,
			"storeType": 1,
			"havePortal": 1,
			"shippingDetail": 0,
			"instruction": null
		}
	};
	var url = 'https://legacy-api.onthedot.com/api/v1.0/stores';
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			document.getElementById("storeDetails").innerHTML = xhrRequest.responseText;
		}
	};
	xhrRequest.open("POST", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	var parsedValue = JSON.stringify(userData);
	xhrRequest.send(parsedValue);
                                            
                                                                

Get store information by storeId

This fetches the store information based on the storeId.

Resource properties
Resource URL
https://<domain-name>/service/v1/stores/{:storeId}
HTTP Method GET
Resource type Record
Response entity type Store
Response format JSON
Request
Query parameters
no-links Not supported1
filter Not supported1
how many Not supported1
meta Not supported1
locale Optional, default is ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
Channel Required
x-client-trans-id Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Path param
storeId Unique Identifier for the store
Response
Response Headers
Content-Type Optional
Content-Length Optional
x-client-trans-id Optional
Date Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response fields
Name Type Description
storeId String This can be either the store_id that has been supplied by us or supplied by the retailer
retailerName String Retailer name
imageUrl String image\logo path of Store
timeslotDuration Numeric Default timeslot duration of store
isDrivenMileage String Distance calculation configuration.
address Store\address
firstLine String Retailer first address line
secondLine String Retailer second address line
city String Retailer city
state String State where store resides
postCode String Retailer postcode
country String Retailer country
info Store\info
storeName String Store\Branch Name
mobileNumber String mobile number which belongs to store
businessPhoneNumber String Contact phone number of store
website String Store website
storeDesc String Description of the store
userName String Username of retailer with which stored has been registered
branchEmail String Email address of store
branchInStoreTime Integer Time spent at store for collecting the packages by default 30 minutes
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Service center code for the store
accountType String Account type credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Store open time on the booking date
closeTime String Store closing time on the booking date
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location location
lat String Latitude of the store
lng String Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
Exceptions and Error codes
Status Error Id Error Code HTTP Code Description
Success ok 200 Request completes
Error ET-ST-001 STORE_NOT_AVAILABLE 404 Store not available
Generic Error
Error EX-AUTH-001 UNAUTHORIZED 401 Unauthorized, API key is not valid
Error EX-FORB-001 QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error EX-COMM-001 INTERNAL_SERVER_ERROR 500 Internal server error
Error EX-COMM-002 SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                                    
    curl -X GET https://legacy-api.onthedot.com/api/v1.0/stores/1234567  --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json"
                                                    
                                                                                                
                                                    
    {
       "data":{
          "storeId":"1234567",
          "retailerName":"Xyz store",
		  "imageUrl":"",
		  "maxmiles": 10,
		  "minmiles": 0,
		  "timeslotDuration": 1,
          "address":{
             "firstLine":"Street 1",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":null,
             "closeTime":null,
             "openingHours":{
                "MON":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00",
                "THU":"11:00 - 18:00",
                "FRI":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed"
             },
             "bankHolidayDetails":{
                "New Years Day":"12:00 - 17:00",
                "Good Friday":"Closed",
                "Easter Sunday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Boxing Day":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
		  "isDrivenMileage":null
       },
       "success":{
          "status":"ok"
       }
    }
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/stores/');
    //storeId
    define('STORE_ID', "1234567");
    //Get Store API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json"
    );
    /**
     * This function will make call to Get Store API and gets the response from the API
     * @param array $headers headers for API call
     * @return json response from API
    */
    function getStore(array $headers) {
        $ch = curl_init(API_URL.STORE_ID);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call getStore
    $response = getStore($headers);
    //API response
    if(is_array($response)){
        print_r( $response);
    }else{
        echo $response;
    }
                                                    
                                                                                                
                                                    
    {
       "data":{
          "storeId":"1234567",
          "retailerName":"Xyz store",
          "imageUrl":"",
          "address":{
             "firstLine":"Street 1",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":null,
             "closeTime":null,
             "openingHours":{
                "MON":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00",
                "THU":"11:00 - 18:00",
                "FRI":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed"
             },
             "bankHolidayDetails":{
                "New Years Day":"12:00 - 17:00",
                "Good Friday":"Closed",
                "Easter Sunday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Boxing Day":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
       },
       "success":{
          "status":"OK"
       }
    }
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to create a store and get store details from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Store { /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String STORE_URLSUFFIX="/api/v1.0/stores/"; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; private static final int SUCCESS=200; private static final int CREATED=201; public static void main(String[] args) throws IOException { //Get store details for storeId getStore(); } private static void getStore() { try { System.out.println("------------------- Store#getStoreDetail-----------------"); //Read the get store url from config file URL url = getUrl(STORE_URLSUFFIX+STORE_ID); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); //It is a HTTP GET Call. connection.setRequestMethod("GET"); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var storeId = '123'; // put your storeId here
	var url = 'https://legacy-api.onthedot.com/api/v1.0/stores/'+storeId;
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);
		}
	};
	xhrRequest.open("GET", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	xhrRequest.send();
                                            
                                                                                

Update Store

Update the store information.

Resource properties
Resource URL
https://<domain-name>/service/v1/stores/{:storeId}
HTTP Method PUT
Resource type Object
Response entity type Store
Response format JSON
Request
Query parameters
no-links Not supported1
filter Not supported1
how many Not supported1
meta Not supported1
locale Default value ‘en’.
Currently only supports ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
Channel Required
x-client-request-id Optional
domain Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Request fields
Name Entity Type Required Description
Store
storeId Alphanumeric Optional This can be the storeId that was supplied by us or the retailer
retailerName String Optional

min length:1
max length:30
Retailer name
imageUrl String Optional image\logo path of Store
timeslotDuration Numeric Optional

min length:1
max length:24
The default duration of timeslot configured at store level which will be used for delivery window.
isDrivenMileage String Optional Valid entry will be "Y" or "N". Which will determine distance calculation is based on driven mileage or Crow Flies depending on commercials agreed.
address Store\address
firstLine String Optional

min length:1
max length:60
First address line of store
secondLine String Optional

max length:60
Second address line of store
city String Optional

max length:60
City where store is located
state String Optional State where store resides
postCode String Optional

min length:1
max length:20
Postcode.
country String Optional Country where store is located.
info Store\info
storeName String Optional

min length:1
max length:30
StoreBranch Name
mobileNumber String Optional

min length:10
max length:13
mobile number which belongs to store.
businessPhoneNumber String Optional

min length:1
max length:32
Contact phone number of store
website String Optional Store website
storeDesc String Optional

min length:1
max length:250
Description of the store
userName String Optional

max length:80
Username of retailer with which stored has been registered
branchEmail String Optional

max length:80
Email address of store
branchInStoreTime Integer Optional

Ex:20,30
Time spent at store for collecting the packages by default 30 minutes.
collectionLeadTime Integer Optional

Ex:20,30
Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Optional Service center code for the store
service String Optional Service associated with account
accountType String Optional By default account type is "credit"
accountNumber String Optional

max length:9
By default use "W99969" for store creation or use the one that has been supplied by CitySprint/On the dot.

Note: If no update are required then don't use this attribute
openTime String Optional

Ex:"10:00","18:30"
Store open time on the booking date
closeTime String Optional

Ex:"10:00","18:30"
Store closing time on the booking date
openingHours Map<String, String> Optional Store open and close times for an entire week
bankHolidayDetails Map<String, String> Optional Bank holidays of the store
location location
lat String Optional

Ex:"51.5574352" ,"-0.092058"
Latitude of the store
lng String Optional

Ex:"51.5574352" ,"-0.092058"
Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String Optional

min length:0
max length:1
0(NO) and 1(YES)
storeType String Optional

min length:0
max length:3
[1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Optional

min length:0
max length:2
Have website [ NO (0), YESWITHOUTECOMM (1), YESWITHEcomm(2)]
shippingDetail String Optional

min length:0
max length:1
0(NO) and 1(YES)
instruction String Optional Store instruction
Note: (M)andatory, (O)ptional
Response
Response Headers
Content-Type Optional
Content-Length Optional
x-client-trans-id Optional
Date Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response fields
Name Type Description
Store Store details
storeId String This can be either the store_id that has been supplied by us or supplied by the retailer
retailerName String Retailer name
imageUrl String image\logo path of Store
timeslotDuration Numeric Default timeslot duration for store.
isDrivenMileage String Distance calculation configuration.
address Store\address
firstLine String Customer first address line
secondLine String Customer second address line
city String Customer city
state String State where store resides
postCode String Consumer postcode upto 20 char.
country String Consumer country
info Store\info
storeName String Store\Branch Name
mobileNumber String mobile number which belongs to store
businessPhoneNumber String Contact phone number of store
website String Store website
storeDesc String Description of the store
userName String Username of retailer with which stored has been registered
branchEmail String Email address of store
branchInStoreTime Integer Time spent at store for collecting the packages by default 30 minutes.
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Service center code for the store
accountType String Account type credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Store open time on the booking date
closeTime String Store closing time on the booking date
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location location
lat String Latitude of the store
lng String Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), YESWITHOUTECOMM (1), YESWITHEcomm(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
Exceptions and Error codes
Exceptions
Status Error Code HTTP Code Description
Success 200 Success/Resources updated
Error BAD_REQUEST 400 BAD Request
Error INVALID_Channel 400 Channel provided in request body and header cannot be different
Error STORE_NOT_AVAILABLE 400 Store Not Avaialable
Generic Error
Error UNAUTHORIZED 401 Unauthorized, API key is not valid
Error QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error INTERNAL_SERVER_ERROR 500 Internal server error
Error SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                                    
	curl -X POST https://legacy-api.onthedot.com/api/v1.0/stores/DEV002 --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json" -d "{\"storeId\":\"1\",\"retailerName\":\"CitySprint\",\"imageUrl\":\"\",\"timeslotDuration\": 1,\"address\":{\"firstLine\":\"line1\",\"secondLine\":\"line2\",\"city\":\"Town C\",\"state\":\"null\",\"postCode\":\"HA11JU\",\"country\":\"United\"},\"info\":{\"storeName\":\"UAT003\",\"mobileNumber\":\"7777777777\",\"businessPhoneNumber\":\"7777777777\",\"website\":\"www.hello.com\",\"storeDesc\":\"A well known bran\",\"userName\":\"xyz@citysprint.co.uk\",\"branchEmail\":\"xyzstore@mail.com\",\"branchInStoreTime\":\"30\",\"collectionLeadTime\":\"null\",\"serviceCenterCode\":\"WO-SD\",\"accountType\":\"credit\",\"accountNumber\":\"W99969\",\"openTime\":\"null\",\"closeTime\":\"null\",\"openingHours\":{\"MON\":\"11:00 - 18:00\",\"TUE\":\"11:00 - 18:00\",\"WED\":\"11:00 - 18:00\",\"THU\":\"11:00 - 18:00\",\"FRI\":\"11:00 - 18:00\",\"SAT\":\"11:00 - 18:00\",\"SUN\":\"Closed\"},\"bankHolidayDetails\":{\"New Years Day\":\"12:00 - 17:00\",\"Good Friday\":\"Closed\",\"Easter Sunday\":\"12:00 - 17:00\",\"Easter Monday\":\"12:00 - 17:00\",\"Early May Bank Holiday\":\"12:00 - 17:00\",\"Summer Bank Holiday\":\"12:00 - 17:00\",\"Christmas Day\":\"12:00 - 17:00\",\"Boxing Day\":\"12:00 - 17:00\"},\"service\":\"\"},\"location\":{\"lat\":\"51.581163\",\"lng\":\"51.581163\"},\"knowMore\":{\"likeToBePartnerRetailer\":\"1\",\"storeType\":\"1\","havePortal\":\"1\","shippingDetail\":\"0\","instruction\":\"null\"}}
                                                    
                                                                                                
                                                    
    {
	"data": {
    "storeId": "DEV002",
    "retailerName": "Xyz store",
    "imageUrl": "",
	"timeslotDuration": 1,
    "address": {
      "firstLine": "1 Regent Street",
      "secondLine": "Street B",
      "city": "Town C",
      "state": null,
      "postCode": "HA11JU",
      "country": "United Kingdom"
    },
    "info": {
      "storeName": "Xyz store",
      "mobileNumber": "7777777777",
      "businessPhoneNumber": "7777777777",
      "website": "www.hello.com",
      "storeDesc": "A well known brand1",
      "userName": "xyz@citysprint.co.uk",
      "branchEmail": "edd@laz.com",
      "branchInStoreTime": 30,
      "collectionLeadTime": null,
      "serviceCenterCode": "WO-SD",
      "accountType": "credit",
      "accountNumber": "W99969",
      "openTime": null,
      "closeTime": null,
      "openingHours": {
        "MON": "11:00 - 18:00",
        "TUE": "11:00 - 18:00",
        "WED": "11:00 - 18:00",
        "THU": "11:00 - 18:00",
        "FRI": "11:00 - 18:00",
        "SAT": "11:00 - 18:00",
        "SUN": "Closed"
      },
      "bankHolidayDetails": {
        "New Years Day": "12:00 - 17:00",
        "Good Friday": "Closed",
        "Easter Sunday": "12:00 - 17:00",
        "Easter Monday": "12:00 - 17:00",
        "Early May Bank Holiday": "12:00 - 17:00",
        "Summer Bank Holiday": "12:00 - 17:00",
        "Christmas Day": "12:00 - 17:00",
        "Boxing Day ": "12:00 - 17:00"
      },
      "service": "Y1"
    },
    "location": {
      "lat": "51.581163",
      "lng": "51.581163"
    },
    "knowMore": {
      "likeToBePartnerRetailer": 1,
      "storeType": 2,
      "havePortal": 1,
      "shippingDetail": 0,
      "instruction": null
    }
	  "isDrivenMileage": null
	  },
	  "success": {
		"status": "OK"
	  }
	}
                                                    
                                                                                                
                                                
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/stores/');
    //storeId
    define('STORE_ID', "1234567");
    //Update Store Payload
    $data = array(
            "storeId"=> STORE_ID,
            "retailerName"=> "Xyz store",
            "imageUrl"=> "",
			"timeslotDuration"=> 1,
            "address"=> array(
                "firstLine"=> "Street updated",
                "secondLine"=> "Street B",
                "city"=> "Town C",
                "state"=> null,
                "postCode"=> "HA11JU",
                "country"=> null
            ),
            "info"=> array(
                "storeName"=>"Xyz store",
                "mobileNumber"=>"7777777777",
                "businessPhoneNumber"=>"7777777777",
                "website"=>"www.hello.com",
                "storeDesc"=>"A well known brand1",
                "userName"=>"xyz@citysprint.co.uk",
                "branchEmail"=>"xyzstore@mail.com",
                "branchInStoreTime"=>30,
                "collectionLeadTime"=>null,
                "serviceCenterCode"=>"WO-SD",
                "accountType"=>"credit",
                "accountNumber"=>"W99969",
                "openTime"=>null,
                "closeTime"=>null,
                "openingHours"=> array(
                     "MON"=>"11:00 - 18:00",
                     "TUE"=>"11:00 - 18:00",
                     "WED"=>"11:00 - 18:00",
                     "THU"=>"11:00 - 18:00",
                     "FRI"=>"11:00 - 18:00",
                     "SAT"=>"11:00 - 18:00",
                     "SUN"=>"Closed"
                ),
                "bankHolidayDetails"=> array(
                    "Boxing Day"=> "12:00 - 17:00",
                    "Christmas Day"=> "12:00 - 17:00",
                    "Early May Bank Holiday"=> "12:00 - 17:00",
                    "Easter Monday"=> "12:00 - 17:00",
                    "Easter Sunday"=> "12:00 - 17:00",
                    "Good Friday"=> "Closed",
                    "New Years Day"=> "12:00 - 17:00",
                    "Summer Bank Holiday"=> "12:00 - 17:00"
                ),
                "service"=>null
            ),
            "location"=> array(
                "lat"=> "51.581163",
                "lng"=> "51.581163"
            ),
            "knowMore"=> array(
                "likeToBePartnerRetailer"=> 1,
                "storeType"=> 1,
                "havePortal"=> 1,
                "shippingDetail"=> 0,
                "instruction"=>null
            )
    );
    //Update Store API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json"
    );
    /**
     * Call to Update Store API
     * @param array $data
     * @param array $headers
     * @return string json response
     */
    function updateStore(array $data,array $headers) {
        $ch = curl_init(API_URL.STORE_ID);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call updateStore
    $response = updateStore($data, $headers);
    //API response
    if(is_array($response)){
        print_r( $response);
    }else{
        echo $response;
    }
                                                    
                                                
                                                                                                
                                                
    {
       "data":{
          "storeId":"1234567",
          "retailerName":"Xyz store",
		  "timeslotDuration": 1,
          "imageUrl":"",
          "address":{
             "firstLine":"House A",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":null,
             "closeTime":null,
             "openingHours":{
                "MON":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00",
                "THU":"11:00 - 18:00",
                "FRI":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed"
             },
             "bankHolidayDetails":{
                "New Years Day":"12:00 - 17:00",
                "Good Friday":"Closed",
                "Easter Sunday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Boxing Day":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
		  "isDrivenMileage":null
       },
       "success":{
          "status":"OK"
       }
    }
                                                
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to create a store and get store details from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Store { /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String STORE_URLSUFFIX="/api/v1.0/stores/"; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; private static final int SUCCESS=200; private static final int CREATED=201; public static void main(String[] args) throws IOException { //update the store details for storeId updateStore(); } private static void updateStore() { try { System.out.println("------------------- Store#updateStore---------------"); //load the store payload //make sure that request payload storeId and uri storeId //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/otd-json-samples.rar and keep it in classpath InputStream fileInputStream = Store.class.getClassLoader().getResourceAsStream("update-store.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); //Read the put store url from config file URL url = getUrl(STORE_URLSUFFIX+STORE_ID); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //It is a HTTP PUT Call. connection.setRequestMethod("PUT"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type",contentType); connection.setRequestProperty("Content-Length", fileContent.length()+ ""); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); DataOutputStream outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var updateStoreData = {
		"storeId": "dd8aaac3-f432-4286-a916-3137c8a079c9",
		"retailerName": "Xyz store",
		"imageUrl": "",
		"timeslotDuration": 1,
		"address": {
			"firstLine": "1 Rama Apartments",
			"secondLine": "Street B",
			"city": "Town C",
			"state": null,
			"postCode": "HA1 1JU",
			"country": null
		},
		"info": {
			"storeName": "Xyz store",
			"mobileNumber": "7777777777",
			"businessPhoneNumber": "7777777777",
			"website": "www.hello.com",
			"storeDesc": "A well known brand1",
			"userName": "xyz@citysprint.co.uk",
			"branchEmail": "xyzstore@mail.com",
			"branchInStoreTime": 30,
			"collectionLeadTime": null,
			"serviceCenterCode": "WO-SD",
			"accountType": "credit",
			"accountNumber": "W99969",
			"openTime": null,
			"closeTime": null,
			"openingHours": {
				"MON": "11:00 - 18:00",
				"TUE": "11:00 - 18:00",
				"WED": "11:00 - 18:00",
				"THU": "11:00 - 18:00",
				"FRI": "11:00 - 18:00",
				"SAT": "11:00 - 18:00",
				"SUN": "Closed"
			},
			"bankHolidayDetails": {
				"New Years Day": "12:00 - 17:00",
				"Good Friday": "Closed",
				"Easter Sunday": "12:00 - 17:00",
				"Easter Monday": "12:00 - 17:00",
				"Early May Bank Holiday": "12:00 - 17:00",
				"Summer Bank Holiday": "12:00 - 17:00",
				"Christmas Day": "12:00 - 17:00",
				"Boxing Day ": "12:00 - 17:00"
			},
			"service": "Y0"
		},
		"location": {
			"lat": "51.581163",
			"lng": "51.581163"
		},
		"knowMore": {
			"likeToBePartnerRetailer": 1,
			"storeType": 1,
			"havePortal": 1,
			"shippingDetail": 0,
			"instruction": null
		}
		"isDrivenMileage":null
	}
	var storeId = 'dd8aaac3-f432-4286-a916-3137c8a079c9'; //put your storeId here
	var url = 'https://legacy-api.onthedot.com/api/v1.0/stores/'+storeId;
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);
		}
	};
	xhrRequest.open("PUT", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	var parsedValue = JSON.stringify(updateStoreData);
	xhrRequest.send(parsedValue);
                                            
                                                                                

Choose delivery time

To the check the in-zone and out-of-zone for the delivery, based on the pickup and drop location. In-zone and out-of-zone definition will be governed based on consumer, default, and retailer, if storeId is present as part of the request. API will return all the available time slots assuming the item is currently available to be delivered. In case of future delivery, timeslots will be based on 'readyat' and 'deliverydate' parameter.

Resource Properties
Resource URL https://<domain-name>/service/v1/timeslots/
HTTP Method POST
Resource type Collection
Response entity type Collection of timeslot
Response format JSON
Request
Query parameters
no-links Not supported1
Filter Not supported1
how many Optional2
Meta Not supported1
Locale Default value ‘en’.
Currently only supports ‘en’
Filter Not supported1
1 This feature is not supported by the current version of the API
2 This is supported in the current version of the API but not used by this API
HTTP Headers
Authorization Required
Accept Optional
x-client-request-id Optional
Channel Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Request Fields
Name Entity type Required Description
Store Store
storeId alphanumeric Mandatory This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
info Store/info
openTime String Optional

Ex:"10:00","18:30"
Day open time for overriding the configured open time in the system for generating the quotes
closeTime String Optional

Ex:"10:00","18:30"
Day close time for overriding the configured close time in the system for generating the quotes
consumer Consumer
address Consume/address
postCode Alphanumeric Mandatory

min length:1
max length:20
Delivery drop postcode
Items Items details
readyAt String Mandatory

Ex:"2017-06-15T14:00:00Z"
Items ready from time
deliveryDate String Mandatory

Ex:"2017-06-15
Package delivery date. In case this is not given then would be considered as ‘readyAt’ date
Note: (M)andatory, (O)ptional
Response
Response Header
Content-Type Required
Content-Length Required
x-client-trans-id Optional
Date Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response Fields
Name Entity type Description
uuid String Unique identifier for the booking transaction
zone String Zone between consumer and retailer postcode.
Ex. 'within', 'adhoc'
store Store
storeId alphanumeric This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
info Store/info
openTime String Day open time for overriding the configured open time in the system for generating the quotes
closeTime String Day close time for overriding the configured close time in the system for generating the quotes
consumer Consumer
address Consumer/address
postCode Alphanumeric Delivery drop postcode
items This section is to record the details of the items to be collected. These must be unique for each booking.
readyAt Date Package ready time at store
deliveryDate Date Package delivery date. In case this is not given then would be considered as ‘readyAt’ date
timeslots Collection of timeslots Collection of timeslots
timeslotId String Time slot unique id.
Note: Random id generated to identify a timeslot offered and does not have any specific format.
startTime Date Start time of the timeslot
endTime Date End time of the timeslot
expiresAt Date Expiry time of the time slot
quote Quote for specific timeslot
total String Total cost of delivery
price String Price quote for delivery in specific timeslot
vat String VAT (value added tax)
Exceptions and Error codes
Status Error Code HTTP Code Description
Success 200 Request completes
Error SLOT_NOT_AVAILABLE 404 Timeslot not available for the specified dates
Error DELIVERY_DATE_IN_PAST 400 Delivery date should not be before today’s date
Error STORE_ID_MANDATORY 400 storeId is mandatory
Error POST_CODE_MANDATORY 400 PostCode cannot be null
Error SERVICE_CENTER_MISSING 400 Service center of a store is missing
Error SERVICE_CODE_MISSING 400 Service required for timeSlot is missing
Generic Error
Error UNAUTHORIZED 401 Unauthorized, API key is not valid
Error QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error INTERNAL_SERVER_ERROR 500 Internal server error
Error SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                                    
    curl -X POST https://legacy-api.onthedot.com/api/v1.0/timeslots --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json" -d "{\"store\":{\"storeId\":\"123\",\"info\":{\"openTime\":\"09:30\",\"closeTime\":\"18:00\"}},\"consumer\":{\"address\":{\"postCode\":\"HA11JU\"}}, \"readyAt"\:"2015-08-28T08:00:00Z",\"deliveryDate"\:"2015-08-29"}}"
                                                    
                                                                                                
                                                    
    {
       "data":{
          "uuid":"1c8bdadf-9c4c-4920-b1bf-de9dfafb4f0f",
          "consumer":{
             "address":{
                "postCode":"HA11JU"
             }
          },
          "store":{
             "storeId":"123",
             "info":{
                "openTime":"09:30",
                "closeTime":"18:00"
             }
          },
          "items": {
            "readyAt": "2016-04-11T13:20:00Z",
            "deliveryDate": "2016-04-11T00:00:00Z",
                   },
          "zone":"within",
           "timeslots":[
             {
                "timeslotId":"31216-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T12:00:00Z",
                "endTime":"2015-10-06T13:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31217-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T13:00:00Z",
                "endTime":"2015-10-06T14:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31218-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T14:00:00Z",
                "endTime":"2015-10-06T15:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31219-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T15:00:00Z",
                "endTime":"2015-10-06T16:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31220-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T16:00:00Z",
                "endTime":"2015-10-06T17:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31221-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T17:00:00Z",
                "endTime":"2015-10-06T18:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31222-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T18:00:00Z",
                "endTime":"2015-10-06T19:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             }
          ]
       },
       "success":{
          "status":"OK"
       }
    }
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/timeslots');
    //Post code
    define('POST_CODE', 'HA11JU');
    //time slot payload
    $data = array(
        "store"=> array(
            "storeId"=> "123",
            "info"=> array(
                "openTime"=> "09:30",
                "closeTime"=> "18:00"
            )
        ),
        "consumer" => array(
            "address" => array(
                "postCode" => POST_CODE
            )
        ),
         "items" => array(
            "readyAt"=> "2015-10-06T09:00:00Z",
            "deliveryDate"=> "2015-10-06"
        )
    );
    //time slot headers
    $headers = array(
        "Authorization: Bearer ".API_KEY,
        "Channel: ECOM",
        "Content-Type: application/json"
    );
    /**
    * This function will make call to Time Slot API and gets the response from the API
    * @param array $data payload for API
    * @param array $headers headers for API call
    * @return json response from API
    */
    function getTimeSlot(array $data, array $headers) {
    $ch = curl_init(API_URL);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
    $result = curl_exec($ch);
    if(curl_errno($ch))
    {
        return curl_error($ch);
    }
    curl_close($ch);
    return $result;
    }
    $response = getTimeSlot($data, $headers);
    if(is_array($response)){
    print_r( $response);
    }else{
    echo $response;
    }
                                                    
                                                                                                
                                                    
    {
       "data":{
          "uuid":"1c8bdadf-9c4c-4920-b1bf-de9dfafb4f0f",
          "consumer":{
             "address":{
                "postCode":"HA11JU"
             }
          },
          "store":{
             "storeId":"123",
             "info":{
                "openTime":"09:30",
                "closeTime":"18:00"
             }
          },
          "items": {
            "readyAt": "2016-04-11T13:20:00Z",
            "deliveryDate": "2016-04-11T00:00:00Z",
          },
          "zone":"within",
          "timeslots":[
             {
                "timeslotId":"31216-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T12:00:00Z",
                "endTime":"2015-10-06T13:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31217-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T13:00:00Z",
                "endTime":"2015-10-06T14:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31218-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T14:00:00Z",
                "endTime":"2015-10-06T15:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31219-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T15:00:00Z",
                "endTime":"2015-10-06T16:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31220-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T16:00:00Z",
                "endTime":"2015-10-06T17:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31221-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T17:00:00Z",
                "endTime":"2015-10-06T18:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31222-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T18:00:00Z",
                "endTime":"2015-10-06T19:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             }
          ]
       },
       "success":{
          "status":"OK"
       }
    }
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to get list of time slot and request parameters that were used to get the time slot * for a particular timeslot id * from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, * Apache HttpComponents v4.5 or newer *

* *

* With Onthedot account/ subscription you must have received Authorization * token, domain and Channel keys. *

* * * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class TimeSlot { /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String TIMESLOTS_URLSUFFIX="/api/v1.0/timeslots/"; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; //make sure that timeslot id belongs to storeId private static String TIMESLOT_ID="32606-7zafskwt07c4"; private static final int SUCCESS=200; private static final int CREATED=201; public static void postTimeSlot() { try { System.out.println("------------------- TimeSlot#postTimeSlots---------------"); //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/otd-json-samples.rar and keep it in classpath InputStream fileInputStream = TimeSlot.class.getClassLoader().getResourceAsStream("post-timeslots-body.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); URL url =getUrl(TIMESLOTS_URLSUFFIX); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //It is a HTTP POST Call. connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type",contentType); connection.setRequestProperty("Content-Length",fileContent.length() + ""); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); DataOutputStream outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ public static void main(String[] args) throws IOException { //get the list of time slots for the given readyAt and deliveryDate. //Please make sure that deliveryDate is current or future day postTimeSlot(); } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	//timeslot payload
	var timeslotData = {
	   "consumer": {
			"address": {
				"postCode": "RM20 2ZP"
			}
		},
		"items": {
				"readyAt": "2016-04-11T13:20:00Z",
				"deliveryDate": "2016-04-11T00:00:00Z",
				 },
		"store": {
			"storeId": "GRAYS-RM202ZP",
			"info": {
				"openTime": "09:30",
				"closeTime": "20:00"
			}
		}
	};
	var url = 'https://legacy-api.onthedot.com/api/v1.0/timeslots';
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);  //your response
		}
	};
	xhrRequest.open("POST", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	var parsedValue = JSON.stringify(timeslotData);
	xhrRequest.send(parsedValue);
                                            
                                                                                

Choose delivery time across days

To the check the in-zone and out-of-zone for the delivery, based on the pickup and drop location. In-zone and out-of-zone definition will be governed based on consumer, default, and retailer, if storeId is present as part of the request. API will return all the available time slots for series of dates assuming the item is currently available to be delivered. In case of future delivery, timeslots will be based on 'readyat' and 'deliverydate' parameter.

Resource Properties
Resource URL https://<domain-name>/service/v1/timeslotsV2/
HTTP Method POST
Resource type Collection
Response entity type Collection of timeslot
Response format JSON
Request
Query parameters
no-links Not supported1
Filter Not supported1
how many Optional2
Meta Not supported1
Locale Default value ‘en’.
Currently only supports ‘en’
Filter Not supported1
1 This feature is not supported by the current version of the API
2 This is supported in the current version of the API but not used by this API
HTTP Headers
Authorization Required
Accept Optional
x-client-request-id Optional
Channel Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Request Fields
Name Entity type Required Description
Store Store
storeId alphanumeric Mandatory This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
timeslotDuration alphanumeric Mandatory The duration of timeslot used for delivery window.If not specified default value will be store timeslot duration specified during store creation.
consumer Consumer
address Consume/address
postCode Alphanumeric Mandatory

min length:1
max length:20
Delivery drop postcode
Items Items details
readyAt String Mandatory

Ex:"2017-06-15T14:00:00Z"
Items ready from time
deliveryDates List of delivery dates to retrive timeslots.
deliveryDate String Mandatory

Ex:"2017-06-15"
Package delivery date.
openTime String Optional

Ex:"10:00","18:30"
Day open time for overriding the configured open time in the system for generating the quotes
closeTime String Optional

Ex:"10:00","18:30"
Day close time for overriding the configured close time in the system for generating the quotes
Note: (M)andatory, (O)ptional
Response
Response Header
Content-Type Required
Content-Length Required
x-client-trans-id Optional
Date Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response Fields
Name Entity type Description
uuid String Unique identifier for the booking transaction
zone String Zone between consumer and retailer postcode.
Ex. 'within', 'adhoc'
store Store
storeId alphanumeric This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
info Store/info
openTime String Day open time for overriding the configured open time in the system for generating the quotes
closeTime String Day close time for overriding the configured close time in the system for generating the quotes
consumer Consumer
address Consumer/address
postCode Alphanumeric Delivery drop postcode
items This section is to record the details of the items to be collected.
readyAt Date Package ready time at store
deliveryDate Date Package delivery date. In case this is not given then would be considered as ‘readyAt’ date
timeslots Collection of timeslots Collection of timeslots
timeslotId String Time slot unique id
Note: Random id generated to identify a timeslot offered and does not have any specific format.
startTime Date Start time of the timeslot
endTime Date End time of the timeslot
expiresAt Date Expiry time of the time slot
quote Quote for specific timeslot
total String Total cost of delivery
price String Price quote for delivery in specific timeslot
vat String VAT (value added tax)
Exceptions and Error codes
Status Error Code HTTP Code Description
Success 200 Request completes
Error SLOT_NOT_AVAILABLE 404 Timeslot not available for the specified dates
Error DELIVERY_DATE_IN_PAST 400 Delivery date should not be before today’s date
Error STORE_ID_MANDATORY 400 storeId is mandatory
Error POST_CODE_MANDATORY 400 PostCode cannot be null
Error SERVICE_CENTER_MISSING 400 Service center of a store is missing
Error SERVICE_CODE_MISSING 400 Service required for timeSlot is missing
Generic Error
Error UNAUTHORIZED 401 Unauthorized, API key is not valid
Error QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error INTERNAL_SERVER_ERROR 500 Internal server error
Error SERVICE_UNAVAILABLE 503 Service not available
Error messages
Error identifier(some errors do not have idntifiers) Affected field or parameter(if no error identifier) Error message Error explanation(Some errors have more than one possible cause) Error remedy/workaround
ET-ST-002 Store Id is mandatory The identifier of the desired retail store is not specified.The "storeId" field must not be left blank. Enter the identifier of the desired retail store in the "storeId" field.
ET-ST-008 Consumer post code is out of zone with retailer post code The postcode of the specified consumer is too far from the specified retail store. Enter a different retail store that is closer to the postcode of the consumer. Postcode distance rules vary for each organisation using this API.
ET-TIST-001 Timeslots not found The specified retail store identifier is invalid. Enter the correct store identifier in the "storeId" field.
ET-TIST-001 Timeslots not found Time slots are not available for the specified date. Enter a different date.
ET-TIST-001 Timeslots not found The specified time might be after the closing time of the specified retail store. Verify the closing time of the retail store on the specified day of the week. Enter an alternative time before the closing time of the store on the specified day.
ET-TIST-008 Ready at <yyyy-mm-ddthh:mm:ssz> should be less than delivery date or less than seven future days The "ready at" date and time must be Earlier than the specified delivery date or Less than seven days in the future Enter an alternative "ready at" date and time in the "readyAt" field.
ET-TIST-009 Delivery date <yyyy-mm-dd> must be today or less than eight future days The specified delivery date must be Later than the "ready at" date and Earlier than eight days in the future Enter an alternative delivery date in the "deliveryDate" field.
EX-COMM-001 Internal server error The opening time of the specified retail store has been provided but not the closing time. The "openTime" and "closeTime" fields are optional fields. However, if a value is entered in the "openTime" field, a corresponding value must also be entered in the "closeTime" field. If entering a value in the "openTime" field, enter a value in the "closeTime" field too.
EX-COMM-001 Internal server error The "ready at" date and time are not specified. The "readyAt" fields must not be left blank. Enter the "ready at" date and time in the "readyAt" field.
EX-COMM-001 Internal server error Database errors. The "openTime", "closeTime", and "readyAt" might be not be specified. Verify that the "openTime", "closeTime", and "readyAt" are specified. If all of three are specified but this error persists, contact On the dot.
EX-COMM-004 TIME_FORMAT_UNSUPPORTED The date/time format used to specify the "ready at" date and/or the delivery date is invalid. Use the format "yyyy-mm-ddthh:mm:ssz" to enter the date and time in the "readyAt" field and/or the "deliveryDate" field. Example date and time value for "readyAt" field: 2018-05-16T11:00:00Z
consumer object has missing required properties ([consumer]) The name of the consumer is not specified. The "consumer" field must not be left blank. Enter the name of the consumer in the "consumer" field.
consumer object has missing required properties ([address]) The address of the consumer is not specified. The "address" field must not be left blank. Enter the address of the consumer in the "address" field.
consumer/address object has missing required properties ([postCode]) The postcode of the consumer is not specified. The "postCode" field must not be left blank. Enter a valid UK postcode for the consumer in the "postCode" field.
consumer/address/postCode ECMA 262 regex ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ does not match input string The format used to specify the postcode of the consumer is invalid. UK postcodes are alphanumeric and variable in length. Each UK postcode is divided into two parts separated by a single space: The outward code includes the postcode area and the postcode district, respectively; for example, "PO16". The inward code includes the postcode sector and the postcode unit, respectively; for example, "7GZ". Use a valid UK postcode format to enter a value in the "postCode" field. Valid UK postcode formats include the following: AA9A 9AA A9A 9AA A9 9AA A99 9AA AA9 9AA AA99 9AA
consumer/address/postCode ECMA 262 regex ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ does not match input string The postcode of the consumer is not specified. The "postCode" field must not be left blank. Enter a valid UK postcode for the consumer in the "postCode" field.
items object has missing required properties ([items]) Delivery items are not specified. The "items" field must not be left blank. Specify the items to be delivered.
items object has missing required properties ([deliveryDate]) The delivery date is not specified. The "deliveryDate" field must not be left blank. Enter the delivery date in the "deliveryDate" field.
items object has missing required properties ([readyAt]) The "ready at" date and time are not specified. The "readyAt" fields must not be left blank. Enter the "ready at" date and time in the "readyAt" field.
store object has missing required properties ([store]) The desired retail store is not specified. The "store" field must not be left blank. Specify the desired retail store in the "store" field.
store object has missing required properties ([storeId]) The identifier of the desired retail store is not specified. The "storeId" field must not be left blank. Enter the identifier of the retail store in the "storeId" field.
store/info/openTime ECMA 262 regex ^((([01]?[0-9]|2[0-3]):[0-5][0-9]))$ does not match input string The time format used to specify the opening time of the desired retail store is invalid. Values entered in the "openTime" field must be in "HH:MM" format. Use the format "HH:MM" to enter a value in the "openTime" field, which is an optional field. For example, enter 09:00 in the "openTime" field.
All the parameters in the request below should be replaced with the actual values.
                                                    
    curl -X POST https://legacy-api.onthedot.com/api/v1.0/timeslotsv2 --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json" -d '{\"consumer\": {\"address\": {\"postCode\": \"CF118TT\"}},\"items\": {\"readyAt\": \"2017-6-13T13:00:00Z\",\"deliveryDates\": [{\"deliveryDate\": \"2017-06-15\",\"openTime\": \"10:00\",\"closeTime\": \"21:00\"},{\"deliveryDate\": \"2017-06-16\"}]},\"store\": {\"storeId\": \"AD-CF\",\"timeslotDuration\":2}}
                                                    
                                                                                                
                                                    
    {
      {
  "data": {
    "uuid": "903d9f32-c8f1-4577-b6ab-17b69d174dd4",
    "consumer": {
      "address": {
        "postCode": "CF118TT"
      }
    },
    "store": {
      "storeId": "AD-CF",
      "timeslotDuration": 2
      }
    },
    "items": {
      "readyAt": "2017-6-13T13:00:00Z",
      "deliveryDates": [
        {
          "closeTime": "21:00",
          "openTime": "08:00",
          "deliveryDate": "2017-06-15"
        },
        {
          "closeTime": "21:00",
          "openTime": "08:00",
          "deliveryDate": "2017-06-16"
        }
      ]
    },
    "zone": "within",
    "timeslots": [
      {
        "timeslotId": "165646-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-16T09:00:00Z",
        "endTime": "2017-06-16T11:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165647-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-16T11:00:00Z",
        "endTime": "2017-06-16T13:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165648-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-16T13:00:00Z",
        "endTime": "2017-06-16T15:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165649-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-16T15:00:00Z",
        "endTime": "2017-06-16T17:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165650-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-16T17:00:00Z",
        "endTime": "2017-06-16T19:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165651-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-15T09:00:00Z",
        "endTime": "2017-06-15T11:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165652-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-15T11:00:00Z",
        "endTime": "2017-06-15T13:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165653-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-15T13:00:00Z",
        "endTime": "2017-06-15T15:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165654-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-15T15:00:00Z",
        "endTime": "2017-06-15T17:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      },
      {
        "timeslotId": "165655-5j74uujby0co",
        "expiresAt": "2017-06-13T12:02:45Z",
        "startTime": "2017-06-15T17:00:00Z",
        "endTime": "2017-06-15T19:00:00Z",
        "quote": {
          "total": "0.00",
          "price": "0.00",
          "vat": "0.00"
        }
      }
    ]
  },
  "success": {
    "status": "OK"
  }
}
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/timeslotsV2');
    //Post code
    define('POST_CODE', 'HA11JU');
    //time slot payload
    $data = array(
        "store"=> array(
            "storeId"=> "123",
			"timeslotDuration"=> 2
        ),
        "consumer" => array(
            "address" => array(
                "postCode" => POST_CODE
            )
        ),
         "items" => array(
            "readyAt"=> "2017-10-15T13:20:00Z",
			"deliveryDates"=> array(
			    "deliveryDate"=>"2015-10-16",
                "openTime"=> "10:00",
                "closeTime"=> "20:00")
				
        )
    );
    //time slot headers
    $headers = array(
        "Authorization: Bearer ".API_KEY,
        "Channel: ECOM",
        "Content-Type: application/json"
    );
    /**
    * This function will make call to Time Slot API and gets the response from the API
    * @param array $data payload for API
    * @param array $headers headers for API call
    * @return json response from API
    */
    function getTimeSlot(array $data, array $headers) {
    $ch = curl_init(API_URL);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
    $result = curl_exec($ch);
    if(curl_errno($ch))
    {
        return curl_error($ch);
    }
    curl_close($ch);
    return $result;
    }
    $response = getTimeSlot($data, $headers);
    if(is_array($response)){
    print_r( $response);
    }else{
    echo $response;
    }
                                                    
                                                                                                
                                                    
    {
       "data":{
          "uuid":"1c8bdadf-9c4c-4920-b1bf-de9dfafb4f0f",
          "consumer":{
             "address":{
                "postCode":"HA11JU"
             }
          },
          "store":{
             "storeId":"123",
             "timeslotDuration": 2
          },
          "items": {
            "readyAt": "2017-10-15T13:20:00Z",
			"deliveryDates": [
			{
				"closeTime": "10:00",
				"openTime": "20:00",
				"deliveryDate": "2017-06-16"
			}
      ]
                   },
          "zone":"within",
          "timeslots":[
             {
                "timeslotId":"31216-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T12:00:00Z",
                "endTime":"2015-10-06T14:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31217-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T14:00:00Z",
                "endTime":"2015-10-06T16:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31218-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T16:00:00Z",
                "endTime":"2015-10-06T18:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             },
             {
                "timeslotId":"31219-dbxafsa83i80",
                "expiresAt":"2015-10-01T06:12:59Z",
                "startTime":"2015-10-06T18:00:00Z",
                "endTime":"2015-10-06T20:00:00Z",
                "quote":{
                   "total":"8.34",
                   "price":"6.95",
                   "vat":"1.39"
                }
             }
          ]
       },
       "success":{
          "status":"OK"
       }
    }
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to get list of time slot and request parameters that were used to get the time slot * for a particular timeslot id * from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, * Apache HttpComponents v4.5 or newer *

* *

* With Onthedot account/ subscription you must have received Authorization * token, domain and Channel keys. *

* * * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class TimeSlot { /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String TIMESLOTS_URLSUFFIX="/api/v1.0/timeslotsV2/"; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; //make sure that timeslot id belongs to storeId private static String TIMESLOT_ID="32606-7zafskwt07c4"; private static final int SUCCESS=200; private static final int CREATED=201; public static void postTimeSlot() { try { System.out.println("------------------- TimeSlot#postTimeSlots---------------"); //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/otd-json-samples.rar and keep it in classpath InputStream fileInputStream = TimeSlot.class.getClassLoader().getResourceAsStream("get-timeslotV2.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); URL url =getUrl(TIMESLOTS_URLSUFFIX); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //It is a HTTP POST Call. connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type",contentType); connection.setRequestProperty("Content-Length",fileContent.length() + ""); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); DataOutputStream outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** *

* You will have to change the following to fit your needs: url, * Authorization, domain and Channel. *

*/ public static void main(String[] args) throws IOException { //get the list of time slots for the given readyAt and deliveryDate. //Please make sure that deliveryDate is current or future day postTimeSlot(); } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	//timeslot payload
	var timeslotData = {
	   "consumer": {
			"address": {
				"postCode": "RM20 2ZP"
			}
		},
		"items": {
				"readyAt": "2016-04-11T13:20:00Z",
				
				"deliveryDates":[ {
				"deliveryDate" :"2016-04-12"
				"openTime": "09:00",
				"closeTime": "20:00"
				},
				{
				"deliveryDate" :"2016-04-13"
				"openTime": "09:00",
				"closeTime": "20:00"
				}
				],
				},
		"store": {
			"storeId": "GRAYS-RM202ZP",
			"timeslotDuration":2
			
		}
	};
	var url = 'https://legacy-api.onthedot.com/api/v1.0/timeslots';
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);  //your response
		}
	};
	xhrRequest.open("POST", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	var parsedValue = JSON.stringify(timeslotData);
	xhrRequest.send(parsedValue);
                                            
                                                                                

Create booking

Returns the details of all the bookings of a store.

Resource Properties
Resource URL https://<domain-name>/service/v1/booking
HTTP Method POST
Resource type Entity
Response entity type Booking
Response format JSON
Query parameters
no-links Not supported1
Filter Not supported1
how many Not supported1
meta Not supported1
locale Optional, default value ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
x-client-request-id Optional
UUID Required
Channel Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Request
Name Entity Type Required Description
orderType String
Valid value (Deliver)
Mandatory

max length :1
Deliver
Deliver - Items delivered from Store to Customer. Currently, this is populated with 1. Please do not change this unless specified by On the dot team
supplierId String Mandatory Currently, this is populated with 'CitySprint'. Please do not change this unless specified by On the dot team
accountNumber String Optional

max length: 9
An optional field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
serviceType String Optional

max length:2
An optional field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more. The field length should not exceed 2 char.
referenceNo String Optional

max length: 12
This field is for customer reference. This is shown on invoices.
departmentReferenceNo String Optional

max length: 30
This field is for customer references. This is shown on invoices.
notificationType String Optional Type of notification to be received by user, valid entry would be 'SMS' 'EMAIL'
webhook URL Optional REST representation of the resource for the order created at Retailer end which can be used to update the delivery status
timeslot Timeslot
timeslotId String Mandatory

min length: 1
max length: 30
Selected timeslot id
store Store
storeId Alphanumeric Mandatory This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
instruction String Optional

max length: 100
Instruction provided by store for delivery.
Consumer Consumer
name String Mandatory

min length: 1
max length:20
Consumer name.
email String Optional Consumer email
mobileNumber String Mandatory

min length: 10
max length:13
Consumer mobile number
Eg:(0)7XXXXXXXXX
instruction String Optional

max length:100
Instruction given by consumer for the delivery.
Consumer address Consumer address
firstLine String

min length: 1
max length:60
Consumer first address line.
secondLine String Optional

max length:60
Consumer second address line.
city String Mandatory

max length:60
Consumer City.
postcode Alphanumeric Mandatory

min length: 1
max length:20
Consumer postcode.
Items This section is to record the details of the items to be collected. These must be unique for each booking.
totalItemCount String Optional

Max allowed numeric:9999
Total combined count of all items
totalItemWeight String Optional

Max allowed weight:9999.99
Total combined weight of all items.
item Items item
referenceNumber String Optional

max length:30
This is the unique barcode ID of the item/container to be couriered.
itemContentCount Numeric Optional Number of items for the booking
weight Numeric Optional Weight of the item
length Numeric Optional Length of the item
width Numeric Optional Width of the item
height Numeric Optional Height of the item
description String Optional

max length:60
Item description.
Note: (M)andatory, (O)ptional
Response
Response Headers
Content-Type Required
Content-Length Optional
x-client-trans-id Optional
Date Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response
Name Type Description
booking Booking
uuid uuid uuid for which the booking is done
bookingType String
Valid Value
Type of booking (Credit)
orderType String Type of booking deliver (1-deliver)
orderNo String Job booking number
orderReferenceNo String Booking reference number
orderDate Date Order date
status String Booked
trackingUrl String Live tracking URL of the booking
pod String Proof of delivery
podDate Date Proof of delivery date
podTime Date Proof of delivery time
serviceType String An optional field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more.The field length should not exceed 2 char.
supplierId String To identify the external supplier using the time slot API for getting the time slot. Currently, this is populated with 'CitySprint'. Please do not change this unless specified by On the dot team
subscriptionName String Name of the subscription
voucherCode String Voucher identification
accountNumber String Account number of the store
referenceNo String 12 char. field for customer reference. This is shown on invoices.
departmentReferenceNo String 30 char. field for customer references. This is shown on invoices.
amount
total String Total Amount
vat String VAT amount
Store Store details
storeId String This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
retailerName String Name of the Retailer
imageUrl String Logo of the Retailer
address Store\address
firstLine String First line of store address
secondLine String Second line of store address
city String City where the store is located
state String State where the store is located
postCode String Postcode
country String Country where the store is located
info Store\info
description String Description of the storeA
storeName String Store\Branch Name
mobileNumber String Mobile number which belongs to store
businessPhoneNumber String Business phone number of the store
website String Website of the store\retailer
storeDesc String Description of the store
userName String E-mail address of the store to be registered.
branchEmail String Store email address
branchInStoreTime Integer Time spent at store when collecting the parcel
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Service center code
accountType String Credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Store open time for the booking date
closeTime String Store closing time for the booking date
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location location
lat String Latitude of the store
lng String Longitude of the store
knowMore know more
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
timeslot timeslot object
timeslotId String Selected timeslot ID
startTime ISO-8601 format (time in 00:00-24:00) Start time
For example, 2016-02-17T13:00:00Z
endTime ISO-8601 format (time in 00:00-24:00) End time
For example,2016-02-17T14:00:00Z
consumer
name String Consumer name upto 20 char.
email String Consumer email (Mandatory only when the consumer is a registered user)
mobileNumber numeric Consumer mobile number
Eg:(0)7XXXXXXXXX
instruction String Consumer instruction
webhook String Http URL to which status of a job/booking is pushed from Onthedot
Consumer address Consumer address
firstLine String Consumer first address line upto 60 char.
secondLine String Consumer second line upto 60 char.
city String Consumer City upto 60 char.
state String State where consumer resides
postCode String Consumer postcode upto 20 char.
country String Country where consumer resides
Items Items details
readyAt String Items ready from time
deliveryDate String Delivery date of the item
totalItemCount String Total combined count of all items
totalItemWeight String Total combined weight of all items
item Items\item
referenceNumber String This is the unique barcode ID of the item/container to be couriered upto 30 char.
itemContentCount String Number of items for the booking
totalValue String Approximate cost of the package
weight Numeric Weight of the item
length Numeric Length of the item
width Numeric Width of the item
height Numeric Height of the item
description String Item description upto 60 char.
Exceptions and Error codes
Status Error Id Error Code HTTP Code Description
Success ok 201 Resource created
Error ET-ST-001 STORE_NOT_AVAILABLE 404 Store not available
Error ET-ST-002 STORE_ID_MANDATORY 400 storeId is mandatory
Error ET-PT-002 BAD_REQUEST 400 storeId is mandatory
Generic Error
Error EX-AUTH-001 UNAUTHORIZED 401 Unauthorized, API key is not valid
Error EX-FORB-001 QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error EX-COMM-001 INTERNAL_SERVER_ERROR 500 Internal server error
Error EX-COMM-002 SERVICE_UNAVAILABLE 503 Service not available
Error messages
Error identifier(some errors do not have idntifiers) Affected field or parameter(if no error identifier) Error message Error explanation(Some errors have more than one possible cause) Error remedy/workaround
ET-TIST-001 Timeslot not available for the specified dates The specified time slot is invalid. Enter a new time slot to proceed with the booking.
Timeslot not available for the specified dates The specified retail store identifier is invalid. Enter the correct store identifier in the "storeId" field.
consumer object has missing required properties ([consumer]) The consumer is not specified. The "consumer" field must not be left blank. Enter the name of the consumer in the "consumer" field.
consumer object has missing required properties ([address]) The address of the consumer is not specified. The "address" field must not be left blank. Enter the address of the consumer in the "address" field.
consumer object has missing required properties ([address]) The mobile phone number of the consumer is not specified. The "mobileNumber" field must not be left blank. Enter the mobile phone number of the consumer in the "mobile"Number" field.
consumer object has missing required properties ([address]) The name of the consumer is not specified. The "name" field must not be left blank. Enter the name of the consumer in the "name" field.
consumer/address object has missing required properties ([firstLine]) The first line of the address of the consumer is not specified. The "firstLine" field must not be left blank. Enter a valid UK postcode for the consumer in the "postCode" field.
consumer/address object has missing required properties ([firstLine,postCode]) The first line of the address of the consumer is not specified. The "firstLine" and "postCode" fields must not be left blank. Enter the first line of the address of the consumer in the "firstLine" field. Enter a valid UK postcode for the consumer in the "postCode" field.
consumer/address object has missing required properties ([postCode]) The postcode of the consumer is not specified. The "postCode" field must not be left blank. Enter a valid UK postcode for the consumer in the "postCode" field.
consumer/address/city string <string> entering invalid city in consumer address field for the field city is too long (length: <XX>, maximum allowed: 60 The maximum length of the value entered in the "city" field must be less than or equal to 60 characters. Enter a string value in the "city" field that is less than or equal to 60 characters.
consumer/address/firstLine string is too short (length: 0, required minimum: 1) The first line of the address of the consumer is not specified. The "firstLine" field must not be left blank. Enter the first line of the address of the consumer in the "firstLine" field.
consumer/address/postCode instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "postCode" field must be a string. Enter a string value in the "postCode" field.
consumer/address/postCode ECMA 262 regex ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ does not match input string <string> The format used to specify the postcode of the consumer is invalid. UK postcodes are alphanumeric and variable in length. Each UK postcode is divided into two parts separated by a single space: The outward code includes the postcode area and the postcode district, respectively; for example, "PO16". The inward code includes the postcode sector and the postcode unit, respectively; for example, "7GZ". Use a valid UK postcode format to enter a value in the "postCode" field. Valid UK postcode formats include the following: AA9A 9AA A9A 9AA A9 9AA A99 9AA AA9 9AA AA99 9AA
consumer/address/secondLine instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "secondLine" field must be a string. Enter a string value in the "secondLine" field.
consumer/instruction instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "instruction" field must be a string. Enter a string value in the "instruction" field.
consumer/mobileNumber instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "mobileNumber" field must be a string. Enter a string value in the "mobileNumber" field.
consumer/name instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "name" field must be a string. Enter a string value in the "name" field.
departmentReferenceNo instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "departmentReferenceNo" field must be a string. The field is used for customer references and is shown on invoices. Enter a string value in the "departmentReferenceNo" field.
items object has missing required properties ([items]) Delivery items are not specified. The "items" field must not be left blank. Specify the items to be delivered.
items object has missing required properties ([item]) The delivery item is not specified. The "item" field must not be left blank. Specify the item to be delivered.
orderType object has missing required properties ([orderType]) The order type is not specified. The "orderType" field must not be left blank. Enter the order type in the "orderType" field.
orderType ECMA 262 regex 1 does not match input string <string> The value of the "orderType" field must be 1 to indicate a delivery. Enter 1 in the "orderType" field to indicate a delivery.
orderType instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "orderType" field must be a string. Enter a string value in the "orderType" field.
orderType string is too long (length: <X>, maximum allowed: 1) The value of the "orderType" field must be 1 to indicate a delivery. Enter 1 in the "orderType" field to indicate a delivery.
referenceNo instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "referenceNo" field must be a string. Enter a string value in the "referenceNo" field.
store object has missing required properties ([store]) The desired retail store is not specified. The "store" field must not be left blank. Specify the desired retail store in the "store" field.
store/instruction instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "instruction" field must be a string. Enter a string value in the "instruction" field.
store/storeId instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "storeId" field must be a string. Enter a string value in the "storeId" field.
store/storeId object has missing required properties ([storeId]) The identifier of the desired retail store is not specified. The "storeId" field must not be left blank. Enter the identifier of the desired retail store in the "storeId" field.
supplierId object has missing required properties ([supplierId]) The identifier of the supplier is not specified. The "supplierId" field must not be left blank. Enter the identifier of the supplier in the "supplierId" field.
supplierId instance type (integer) does not match any allowed primitive type (allowed: The value of the "supplierId" field must be a string. Enter a string value in the "supplierId" field.
supplierId ECMA 262 regex CitySprint does not match input string <string> The value of the "supplierId" field must be CitySprint. Enter CitySprint in the "supplierId"
timeslot object has missing required properties ([timeslot]) The desired time slot of the delivery is not specified. The "timeslot" field must not be left blank. Enter the desired time slot in the "timeslot" field.
timeslot object has missing required properties ([timeslotId]) The identifier of the desired time slot is not specified. The "timeslotId" field must not be left blank. Enter the identifier of the desired time slot in the "timeslotId" field.
timeslot/timeslotId instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "timeslotId" field must be a string. Enter a string value in the "timeslotId" field.
All the parameters in the request below should be replaced with the actual values.
                                                    
     curl -X POST https://legacy-api.onthedot.com/api/v1.0/booking --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json" --header "UUID: 7e99d090-03ac-4cd0-96fd-a56435ad0989" -d "{\"timeslot\":{\"timeslotId\":\"30977-3lt632pe9pc0\"},\"webhook\":\"\",\"orderType\":\"1\",\"supplierId\":\"CitySprint\",\"accountNumber\":\"W99969\",\"serviceType\":\"\",\"referenceNo\":\"\",\"departmentReferenceNo\":\"\",\"store\":{\"storeId\":\"123\",\"instruction\":\"test\"},\"consumer\":{\"name\":\"test\",\"email\":\"xyzstore@mail.com\",\"mobileNumber\":\"7777777777\",\"address\":{\"firstLine\":\"testaddress\",\"secondLine\":\"address2\",\"city\":\"Town C\",\"postCode\":\"HA11JU\"},\"instruction\":\"\"},\"items"\:{\"item"\:[{\"referenceNumber"\:"test ref1",\"itemContentCount"\:1,\"totalValue"\:999866777777,\"weight"\:1,\"length"\:1,\"width"\:1,\"height"\:0, \"description"\:"2 desc"]}}},\"notificationType\":\"\"}"
                                                    
                                                                                                
                                                    
    {
    "data":{
       "bookingType":"Credit",
       "orderType":"1",
       "orderNo":"17402719",
       "orderReferenceNo":"",
       "orderDate":"2015-10-01T08:05:02Z",
       "status":"Booked",
       "trackingUrl":null,
       "pod":null,
       "podDate":null,
       "podTime":null,
       "supplierId":"CitySprint",
       "subscriptionName":"",
       "voucherCode":"",
       "accountNumber":"W99969",
       "amount":{
          "total":"0.0",
          "vat":"0.0"
       },
       "store":{
          "storeId":"123",
          "retailerName":"Xyz store",
          "imageUrl":null,
          "address":{
             "firstLine":"1 Rama Apartments",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA1 1JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":"11:00",
             "closeTime":"18:00",
             "openingHours":{
                "FRI":"11:00 - 18:00",
                "MON":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed",
                "THU":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00"
             },
             "bankHolidayDetails":{
                "Boxing Day ":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Easter Sunday":"12:00 - 17:00",
                "Good Friday":"Closed",
                "New Years Day":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
       },
       "timeslot":{
          "timeslotId":"30977-3lt632pe9pc0",
          "startTime":null,
          "endTime":null
       },
       "consumer":{
          "name":"test",
          "email":"xyzstore@mail.com",
          "instruction":"",
          "webhook":null,
          "mobileNumber":"7777777777",
          "address":{
             "firstLine":"House A",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":""
          }
       },
        "items": {
            "readyAt": "2016-04-11T13:20:00Z",
            "deliveryDate": "2016-04-11T00:00:00Z",
			"totalItemCount":1
			"totalItemWeight":2
            "item": [{
                "referenceNumber": "21"
                "itemContentCount": 2
                "totalValue": "0"
                "weight": 2
                "length": 2
                "width": 2
                "height": 2
                "description": "2 desc"
            }]
        },
       "serviceType":"Y0",
       "uuid":"7e99d090-03ac-4cd0-96fd-a56435ad0989",
    "referenceNo": "123",
    "departmentReferenceNo": "145"
  },
  "success": {
    "status": "ok"
  }
}
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/booking');
    //time slotID
    define('TIME_SLOT_ID', '30978-3lt632pe9pc0');
    //uuid
    define('UUID', '7e99d090-03ac-4cd0-96fd-a56435ad0989');
    //create booking payload
    $data = array(
      "timeslot"=> array(
        "timeslotId"=> "30977-3lt632pe9pc0"
      ),
      "webhook"=> "",
      "orderType"=> "1",
      "supplierId"=> "CitySprint",
      "accountNumber"=> "W99969",
      "serviceType"=> "",
      "referenceNo"=> "",
      "departmentReferenceNo"=> "",
      "store"=> array(
        "storeId"=> "123",
        "instruction"=> "test"
      ),
      "consumer"=> array(
        "name"=> "test",
        "email"=> "xyzstore@mail.com",
        "mobileNumber"=> "7777777777",
        "address"=> array(
          "firstLine"=> "House A",
          "secondLine"=> "Street B",
          "city"=> "Town C",
          "postCode"=> "HA11JU"
        ),
        "instruction"=> ""
      ),
      "items" => array(
            "item" => array (
                "referenceNumber" => "21"
                "itemContentCount" => 2,
                "totalValue" => "0",
                "weight" => 2,
                "length" => 2,
                "width" => 2,
                "height" => 2,
                "description" => "2 desc"
            )

        ),
      "notificationType"=> ""
    );
    //Booking API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json",
            "UUID: ".UUID
    );
    /**
     * This function will make call to doBooking API and gets the response from the API
     * @param array $data payload for API
     * @param array $headers headers for API call
     * @return json response from API
     */
    function doBooking(array $data, array $headers) {
        $ch = curl_init(API_URL);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call doBooking
    $response = doBooking($data, $headers);
    //API response
    if(is_array($response)){
        print_r( $response);
    }else{
        echo $response;
    }
                                                    
                                                                                                
                                                    
    {
    "data":{
       "bookingType":"Credit",
       "orderType":"1",
       "orderNo":"17402719",
       "orderReferenceNo":"",
       "orderDate":"2015-10-01T08:05:02Z",
       "status":"Booked",
       "trackingUrl":null,
       "pod":null,
       "podDate":null,
       "podTime":null,
       "supplierId":"CitySprint",
       "subscriptionName":"",
       "voucherCode":"",
       "accountNumber":"W99969",
       "amount":{
          "total":"0.0",
          "vat":"0.0"
       },
       "store":{
          "storeId":"123",
          "retailerName":"Xyz store",
          "imageUrl":null,
          "address":{
             "firstLine":"1 Rama Apartments",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA1 1JU",
             "country":null
          },
          "info":{
             "storeName":"Xyz store",
             "mobileNumber":"7777777777",
             "businessPhoneNumber":"7777777777",
             "website":"www.hello.com",
             "storeDesc":"A well known brand1",
             "userName":"xyz@citysprint.co.uk",
             "branchEmail":"xyzstore@mail.com",
             "branchInStoreTime":30,
             "collectionLeadTime":null,
             "serviceCenterCode":"WO-SD",
             "accountType":"credit",
             "accountNumber":"W99969",
             "openTime":"11:00",
             "closeTime":"18:00",
             "openingHours":{
                "FRI":"11:00 - 18:00",
                "MON":"11:00 - 18:00",
                "SAT":"11:00 - 18:00",
                "SUN":"Closed",
                "THU":"11:00 - 18:00",
                "TUE":"11:00 - 18:00",
                "WED":"11:00 - 18:00"
             },
             "bankHolidayDetails":{
                "Boxing Day ":"12:00 - 17:00",
                "Christmas Day":"12:00 - 17:00",
                "Early May Bank Holiday":"12:00 - 17:00",
                "Easter Monday":"12:00 - 17:00",
                "Easter Sunday":"12:00 - 17:00",
                "Good Friday":"Closed",
                "New Years Day":"12:00 - 17:00",
                "Summer Bank Holiday":"12:00 - 17:00"
             },
             "service":null
          },
          "location":{
             "lat":"51.581163",
             "lng":"51.581163"
          },
          "knowMore":{
             "likeToBePartnerRetailer":1,
             "storeType":1,
             "havePortal":1,
             "shippingDetail":0,
             "instruction":null
          }
       },
       "timeslot":{
          "timeslotId":"30977-3lt632pe9pc0",
          "startTime":null,
          "endTime":null
       },
       "consumer":{
          "name":"test",
          "email":"xyzstore@mail.com",
          "instruction":"",
          "webhook":null,
          "mobileNumber":"7777777777",
          "address":{
             "firstLine":"House A",
             "secondLine":"Street B",
             "city":"Town C",
             "state":null,
             "postCode":"HA11JU",
             "country":""
          }
       },
        "items": {
            "readyAt": "2016-04-11T13:20:00Z",
            "deliveryDate": "2016-04-11T00:00:00Z",
            "item": [{
                    "referenceNumber": "21"
                    "itemContentCount": 2
                    "totalValue": "0"
                    "weight": 2
                    "length": 2
                    "width": 2
                    "height": 2
                    "description": "2 desc"
                     }]
        },
       "serviceType":"Y0",
       "uuid":"7e99d090-03ac-4cd0-96fd-a56435ad0989"
     "referenceNo": "123",
    "departmentReferenceNo": "145"
  },
  "success": {
    "status": "ok"
  }
}
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to add,get and update bookings from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Booking { private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String POST_BOOKING_URLSUFFIX="/api/v1.0/booking"; private static final int SUCCESS=200; private static final int CREATED=201; public static void main(String[] args) throws IOException { //add booking //Make sure that timeslot id belongs to storeId addBooking(); } private static void addBooking() { try { System.out.println("------------------- Booking#addBooking-------------"); //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/otd-json-samples.rar and keep it in classpath InputStream fileInputStream = Booking.class.getClassLoader().getResourceAsStream("add-booking.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); //Read the post booking url from config file URL url = getUrl(POST_BOOKING_URLSUFFIX); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //It is a HTTP POST Call. connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type",contentType); connection.setRequestProperty("Accept", Accept); connection.setRequestProperty("Content-Length",fileContent.length() + ""); // Following HTTP headers are mandatory: Authorization, Channel and Accept. setHttpHeaders(connection); DataOutputStream outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var bookingData = {
	  "timeslot": {
		"timeslotId": "34671-ltcysv6m2zkg"  // Value is taken from 'Choose a timeslot'(previous) response
	  },
	  "webhook": "",
	  "orderType": "1",
	  "supplierId": "CitySprint",
	  "accountNumber": "W99969",
	  "serviceType": "",
	  "referenceNo": "",
	  "departmentReferenceNo": "",
	  "store": {
		"storeId": "123",
		"instruction": "test"
	  },
	  "consumer": {
		"name": "test",
		"email": "xyzstore@mail.com",
		"mobileNumber": "7777777777",
		"address": {
		  "firstLine": "House A",
		  "secondLine": "Street B",
		  "city": "House A",
		  "postCode": "HA11JU"
		},
		"instruction": ""
	  },
	 "items": {
			"item": [{
					"referenceNumber": "21"
					"itemContentCount": 2
					"totalValue": "0"
					"weight": 2
					"length": 2
					"width": 2
					"height": 2
					"description": "2 desc"
				}],
			"readyAt": "2016-04-11T08:00:00Z"
		},
	  "notificationType": ""
	};
	var url = 'https://legacy-api.onthedot.com/api/v1.0/booking';
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);
		}
	};
	xhrRequest.open("POST", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer{{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	xhrRequest.setRequestHeader("UUID", ""{{UUID}}")
	var parsedValue = JSON.stringify(bookingData);
	xhrRequest.send(parsedValue);
                                            
                                                                                

Amend Booking

To make changes to an existing booking use the Amend Booking API. Note that you can make changes to the booking only when the booking status is Booked or Amended.

Resource Properties
Resource URL https://<domain-name>/service/v1/amendbooking
HTTP Method PUT
Resource type Entity
Response entity type Booking
Response format JSON
Query parameters
no-links Not supported1
Filter Not supported1
how many Not supported1
meta Not supported1
locale Optional, default value ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
x-client-request-id Optional
Channel Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
UUID Required
Request
Name Entity Type Required Description
orderType String
Valid value (Deliver)
Mandatory

max length:1
Deliver - Items delivered from store to customer. Currently, this is populated with 1. Please do not change this unless specified by On the dot team
supplierId String Mandatory Currently, this is populated with 'CitySprint'. Please do not change this unless specified by On the dot team
accountNumber String Optional

max length:9
An optional field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot.
Note: if no update required then don't use this attribute .
serviceType String Mandatory

max length:2
An optional field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more.
referenceNo String Optional

max length:12
This field for credit account customers.This field can be editable
departmentReferenceNo String Optional

max length:30
This field is for customer references. This is shown on invoices.This field can be editable
orderNo String Mandatory

max length:10
The order number that is required to get amended.
notificationType String Optional TypType of notification to be received by user, valid entry would be 'SMS' 'EMAIL'.This field can be editable
webhook URL Optional REST representation of the resource for the order created at Retailer end which can be used to update the delivery status.This field can be editable
timeslot timeslot
timeslotId String Mandatory

min length:1
max length:30
Selected timeslot id.This field can be editable
store store
storeId Alphanumeric Mandatory This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
instruction String Optional

max length:100
Instruction provided by store for delivery.This field can be editable
info Store/info
openTime String Optional

Ex:"10:00","18:30"
Day open time for overriding the configured open time in the system for generating the quotes.This field can be editable
closeTime String Optional

Ex:"10:00","18:30"
Day close time for overriding the configured close time in the system for generating the quotes.This field can be editable
consumer consumer
name String Optional

min length:1
max length:20
Consumer name.This field can be editable
email String Optional Consumer email.This field can be editable
mobileNumber String Mandatory

min length:10
max length:13
Consumer mobile number.
Eg:(0)7XXXXXXXXX
.This field can be editable
instruction String Optional

max length:100
Instruction given by consumer for the delivery.This field can be editable
consumer address consumer address
firstLine String Mandatory

min length:1
max length:60
Consumer first address line.This field can be editable
secondLine String Optional

min length:1
max length:60
Consumer second line.This field can be editable
city String Optional

max length:60
Consumer City.
postCode Alphanumeric Mandatory

min length:1
max length:20
Consumer postcode.
Items This section is to record the details of the items to be collected. These must be unique for each booking.
totalItemCount String Optional

Max allowed numeric:9999
Total combined count of all items
totalItemWeight String Optional

Max allowed weight:9999.99
Total combined weight of all items.
item Items item
referenceNumber String Optional

max length:30
This is the unique barcode ID of the item/container to be couriered.
itemContentCount Numeric Optional Number of items for the booking
weight Numeric Optional Weight of the item
length Numeric Optional Length of the item
width Numeric Optional Width of the item
height Numeric Optional
description String Optional
max length:60
Item description.
Note: (M)andatory, (O)ptional
Response
Response Headers
Content-Type Required
Content-Length Optional
x-client-trans-id Optional
Date Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response
Name Type Description
booking Booking
UUID UUID UUID for which the booking is done
bookingType String
Valid Value
Type of booking (Credit)
orderType String Type of booking deliver
orderNo String Job booking number
orderReferenceNo String Booking reference number
orderDate Date Order date
status String Status of the booking
trackingUrl String Live tracking URL of the booking
pod String Proof of delivery
podDate Date Proof of delivery date
podTime Date Proof of delivery time
serviceType String An optional field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more.The field length should not exceed 2 char.
supplierId String To identify the external supplier using the time slot API for getting the time slot. Currently, this is populated with 'CitySprint'. Please do not change this unless specified by On the dot team
subscriptionName String Name of the subscription
voucherCode String Voucher identification
accountNumber String Account number of the store.
referenceNo String 12 char. field for customer reference. This is shown on invoices.
departmentReferenceNo String 30 char. field for customer references. This is shown on invoices.
amount
total String Total Amount
vat String VAT amount
Store Store details
storeId String This can be either the storeid that has been supplied by us, or the store alias that has been provided by the store
retailerName String Name of the Retailer
imageUrl String Logo of the Retailer
address Store\address
firstLine String First line of store address
secondLine String Second line of store address
city String City where the store is located
state String State where the store is located
postCode String Postcode
country String Country where the store is located
info Store\info
description String Description of the store
storeName String Country where the store is located
mobileNumber String Mobile number which belongs to store
businessPhoneNumber String Business phone number of the store
website String Website of the store\retailer
storeDesc String Description of the store
userName String
branchEmail String Store email address
branchInStoreTime Integer Time spent at store when collecting the parcel
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Service center code
accountType String Credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Store open time for the booking date
closeTime String Store closing time for the booking date
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location location
lat String Latitude of the store
lng String Longitude of the store
knowMore know more
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
timeslot timeslot object
timeslotId String Selected timeslot ID
startTime ISO-8601 format (time in 00:00-24:00) Start time
For example, 10:00
endTime ISO-8601 format (time in 00:00-24:00) End time
For example, 11:00
Consumer
name String Consumer name upto 20 char.
email String Consumer email (Mandatory only when the consumer is a registered user)
mobileNumber numeric Consumer mobile number
Eg:(0)7XXXXXXXXX
instruction String Consumer instruction
webhook String Http URL to which status of a job/booking is pushed from Onthedot
Consumer address Consumer address
firstLine String Consumer first address line upto 60 char.
secondLine String Consumer second line upto 60 char.
city String Consumer City upto 60 char.
state String State where consumer resides
postCode String Consumer postcode upto 20 char.
country String Country where consumer resides
Items Items details
readyAt String Items ready from time
deliveryDate String Package delivery date. In case this is not given then would be considered as ‘readyAt’ date
item Items\item
referenceNumber String This is the unique barcode ID of the item/container to be couriered upto 30 char.
itemContentCount String Number of items for the booking
totalValue String Approximate cost of the package
weight Numeric Weight of the item
length Numeric Length of the item
width Numeric Width of the item
height Numeric Height of the item
description String Item description upto 60 char.
Exceptions and Error codes
Status Error Id Error Code HTTP Code Description
Success ok 201 Resource created
Error ET-ST-001 STORE_NOT_AVAILABLE 404 Store not available
Error ET-ST-002 STORE_ID_MANDATORY 400 storeId is mandatory
Error ET-PT-002 BAD_REQUEST 400 storeId is mandatory
Error ET-ST-001 SUBSCRIPTION_NOT_AVAILABLE 404 Subscription not available
Error ET-ST-002 STORE_ID_MANDATORY 400 storeId is mandatory
Error ET-TIST-001 SLOT_NOT_AVAILABLE 404 Timeslot not available for the specified dates
Generic Error
Error EX-AUTH-001 UNAUTHORIZED 401 Unauthorized, API key is not valid
Error EX-FORB-001 QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error EX-COMM-001 INTERNAL_SERVER_ERROR 500 Internal server error
Error EX-COMM-002 SERVICE_UNAVAILABLE 503 Service not available
Error messages
Error identifier(some errors do not have idntifiers) Affected field or parameter(if no error identifier) Error message Error explanation(Some errors have more than one possible cause) Error remedy/workaround
ET-ST-001 Store not available The identifier of the desired retail store is invalid. Enter a valid identifier for the desired retail store.
ET-ST-001 (Blank error message displayed under a job number) This error might occur if any of the "items" fields are incorrect. Verify that the "items" fields are correct. If the "items" fields are correct and the error persists, contact On the dot.
ET-ST-001 Timeslot not available for the specified dates The specified time slot is invalid. Enter a new time slot to proceed with the amended booking.
ET-ST-001 Timeslot not available for the specified dates The identifiers for the time slots of the original booking and the amended booking do not match. Enter a new time slot to proceed with the amended booking.
EX-COMM-001 Internal server error When amending a booking, the order number of the booking must be passed to the Amend Booking API. If the order number passed to the Amend Booking API is incorrect, this error message will be displayed. Verify that the order number of the booking passed to the Amend Booking API is correct. If the order number is correct and the error persists, contact On the dot.
Could not build full log message: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,37] The value of the affected field must be a string. Enter a string value for the field.
consumer The script engine returned an error executing the inlined js script function mediate The name of the consumer is not specified. The "consumer" field must not be left blank. Enter the name of the consumer in the "consumer" field.
consumer object has missing required properties ([name]) The name of the consumer is not specified. The "name" field must not be left blank. Enter the name of the consumer in the "name" field.
consumer/address The script engine returned an error executing the inlined js script function mediate The address of the consumer is not specified. The "address" field must not be left blank. Enter the address of the consumer in the "address" field.
consumer/address/city instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "city" field must be a string. Enter a string value in the "city" field.
consumer/address/city string entering invalid city in consumer address field for the field city is too long (length: , maximum allowed: 60 The maximum length of the value entered in the "city" field must be less than or equal to 60 characters. Enter a string value in the "city" field that is less than or equal to 60 characters.
consumer/address/firstLine instance type (integer) does not match any allowed primitive type (allowed: [null,string] The value of the "firstLine" field must be a string. Enter a string value in the "firstLine" field.
consumer/address/postCode instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "postCode" field must be a string. Enter a string value in the "postCode" field.
consumer/address/postCode The script engine returned an error executing the inlined js script function mediate The postcode of the consumer is not specified. The "postCode" field must not be left blank. Enter a valid UK postcode for the consumer in the "postCode" field. Example valid UK postcode: GU16 7HF.
consumer/address/postCode ECMA 262 regex ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$ does not match input string The format used to specify the postcode of the consumer is invalid. UK postcodes are alphanumeric and variable in length. Each UK postcode is divided into two parts separated by a single space: The outward code includes the postcode area and the postcode district, respectively; for example, "PO16". The inward code includes the postcode sector and the postcode unit, respectively; for example, "7GZ". Use a valid UK postcode format to enter a value in the "postCode" field. Valid UK postcode formats include the following: AA9A 9AA A9A 9AA A9 9AA A99 9AA AA9 9AA AA99 9AA
consumer/address/secondLine instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "secondLine" field must be a string. Enter a string value in the "secondLine" field.
consumer/instruction instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "instruction" field must be a string. Enter a string value in the "instruction" field.
consumer/mobileNumber instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "mobileNumber" field must be a string. Enter a string value in the "mobileNumber" field.
consumer/name instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "name" field must be a string. Enter a string value in the "name" field.
departmentReferenceNo instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "departmentReferenceNo" field must be a string. The field is used for customer references and is shown on invoices. Enter a string value in the "departmentReferenceNo" field.
items object has missing required properties ([item]) The delivery item is not specified. The "item" field must not be left blank. Specify the item to be delivered.
items/item/description Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The description of the delivery item is not specified. The "description" field must not be left blank. Enter a description of the item in the "description" field.
items/item/height Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The height of the delivery item is not specified. The "height" field must not be left blank. Enter the height of the delivery item in the "height" field.
items/item/itemContentCount Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The number of items to be delivered is not specified. The "itemContentCount" field must not be left blank. Enter the number of items to be delivered in the "itemContentCount" field.
items/item/length Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The length of the delivery item is not specified. The "length" field must not be left blank. Enter the length of the delivery item in the "length" field.
items/item/referenceNumber Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The unique barcode identifier of the item/container to be delivered is not specified. The "referenceNumber" field must not be left blank. Enter unique barcode identifier for the delivery item in the "referenceNumber" field.
items/item/weight Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The weight of the delivery item is not specified. The "weight" field must not be left blank. Enter the weight of the delivery item in the "weight" field.
items/item/width Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The width of the delivery item is not specified. The "width" field must not be left blank. Enter the width of the delivery item in the "width" field.
items/readyAt ECMA 262 regex ^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$ does not match input string The date/time format used to specify the "ready at" date/time is invalid. Use the format "yyyy-mm-ddthh:mm:ssz" to enter the date and time in the "readyAt" field. Example date and time value for "readyAt" field: 2018-05-16T11:00:00Z
items/readyAt instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "readyAt" field must be a string. Enter a string value in the "readyAt" field.
items/totalItemCount instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "totalItemCount" field must be a string. Enter a string value in the "totalItemCount" field.
items/totalItemCount ECMA 262 regex ^[0-9]*$ does not match input string The value of the "totalItemCount" field must be a string and the string must be a number. Enter a string value in the "totalItemCount" field. For example, enter 100 (but not one hundred) in the "totalItemCount" field.
items/totalItemCount Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The total number of items for delivery is not specified. The "totalItemCount" field must not be left blank. Enter the total number of items for delivery in the "totalItemCount" field.
items/totalItemWeight instance type (number) does not match any allowed primitive type (allowed: [null,string]) The value of the "totalItemWeight" field must be a string. Enter a string value in the "totalItemWeight" field.
items/totalItemWeight ECMA 262 regex ^[0-9,]*[.]{0,1}[0-9]*$ does not match input string The value of the "totalItemWeight" field must be a string and the string must be a number. Enter a string value in the "totalItemWeight" field. For example, enter 150.50 (but not one hundred and fifty point fifty) in the "totalItemCount" field.
items/totalItemWeight Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The total combined weight of all delivery items is not specified. The "totalItemWeight" field must not be left blank. Enter the total weight of items for delivery in the "totalItemWeight" field.
orderNo object has missing required properties ([orderNo] The order number is not specified. The "orderNo" field must not be left blank. Enter the order number in the "orderNo" field.
orderNo instance type (string) does not match any allowed primitive type (allowed: [integer,number]) The value of the "orderNo" field must be an integer. Enter an integer value in the "orderNo" field.
orderReferenceNo Could not build full log message: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,37] The value of the "orderReferenceNo" field must be a string. Enter a string value in the "orderReferenceNo" field.
orderType object has missing required properties ([orderType] The order type is not specified. The "orderType" field must not be left blank. Enter the order type in the "orderType" field.
orderType instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "orderType" field must be a string. Enter a string value in the "orderType" field.
orderType ECMA 262 regex 1 does not match input string The value of the "orderType" field must be 1 to indicate a delivery. Enter 1 in the "orderType" field to indicate a delivery.
orderType string is too long (length: , maximum allowed: 1 The value of the "orderType" field must be 1 to indicate a delivery. Enter 1 in the "orderType" field to indicate a delivery.
readyAt Unable to perform XSLT transformation using : Value {name ='null', keyValue ='jsontoxmlconversion.xsl'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] reason : null The "ready at" date and time are not specified. The "readyAt" field must not be left blank. Enter the "ready at" date and time in the "readyAt" field.
referenceNo instance type (integer) does not match any allowed primitive type (allowed: [null,string] The value of the "referenceNo" field must be a string. Enter a string value in the "referenceNo" field.
store object has missing required properties ([store]) The desired retail store is not specified. The "store" field must not be left blank. Specify the desired retail store in the "store" field.
store/info/closeTime ECMA 262 regex ^[0-9]{2}:[0-9]{2}$ does not match input string The time format used to specify the closing time of the desired retail store is invalid. Values entered in the "closeTime" field must be in "HH:MM" format. Use the format "HH:MM" to enter a value in the "closeTime" field, which is an optional field. For example, enter 18:00 in the "closeTime" field.
store/info/closeTime instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "closeTime" field must be a string. Enter a string value in the "closeTime" field, which is an optional field. For example, enter 18:00 in the "closeTime" field.
store/info/openTime ECMA 262 regex ^[0-9]{2}:[0-9]{2}$ does not match input string The time format used to specify the opening time of the desired retail store is invalid. Values entered in the "openTime" field must be in "HH:MM" format. Use the format "HH:MM" to enter a value in the "openTime" field, which is an optional field. For example, enter 09:00 in the "openTime" field.
store/info/openTime instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "openTime" field must be a string. Enter a string value in the "openTime" field, which is an optional field.
store/instruction instance type (integer) does not match any allowed primitive type (allowed: [null,string]) The value of the "instruction" field must be a string. Enter a string value in the "instruction" field.
store/storeId object has missing required properties ([storeId]) The identifier of the desired retail store is not specified. The "storeId" field must not be left blank. Enter the identifier of the desired retail store in the "storeId" field.
supplierId instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "supplierId" field must be a string. Enter a string value in the "supplierId" field.
supplierId Supplier Id cannot be changed The value of the "supplierId" field must be CitySprint. Enter CitySprint in the "supplierId" field.
timeslot object has missing required properties ([timeslot]) The desired time slot of the delivery is not specified The "timeslot" field must not be left blank. Enter the desired time slot in the "timeslot" field.
timeslot object has missing required properties ([timeslotId]) The identifier of the desired time slot is not specified. The "timeslotId" field must not be left blank. Enter the identifier of the desired time slot in the "timeslotId" field.
timeslot/timeslotId instance type (integer) does not match any allowed primitive type (allowed: [string]) The value of the "timeslotId" field must be a string. Enter a string value in the "timeslotId" field.
All the parameters in the request below should be replaced with the actual values.
                                                            
	curl -X PUT https://legacy-api.onthedot.com/api/v1.0/amendbooking --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "UUID: {{UUID}}" --header "Content-Type: application/json" -d "{\"orderType\":\"1\",\"supplierId\":\"CitySprint\",\"accountNumber\":\"\",\"serviceType\":\"\",\"referenceNo\":\"\",\"departmentReferenceNo\":\"\",\"notificationType\":\"\",\"webHook\":\"\",\"orderNo\":17402835,\"timeslot\":{\"timeslotId\":\"31220-c2e9sezbldcs\"},\"store\":{\"storeId\":\"123\",\"instruction\":\"update booking curl\",\"info\":{\"openTime\":\"12:30\",\"closeTime\":\"21:30\"}},\"consumer\":{\"name\":\"test\",\"email\":\"xyzstore@mail.com\",\"mobileNumber\":\"7777777777\",\"address\":{\"firstLine\":\"HouseA\",\"secondLine\":\"StreetB\",\"city\":\"TownC\",\"postCode\":\"HA11JU\"},\"instruction\":\"\"},\"items"\:{\"item"\:[{\"referenceNumber"\:"test ref1",\"itemContentCount"\:1,\"totalValue"\:999866777777,\"weight"\:1,\"length"\:1,\"width"\:1,\"height"\:0, \"description"\:"2 desc"]}}}"
                                                            
                                                                                                
                                                            
    {
    "data": {
        "bookingType": "credit",
        "orderType": "1",
        "orderNo": "17446103",
        "orderReferenceNo": "",
        "orderDate": "2016-02-04T11:04:50Z",
        "status": "Amended",
        "trackingUrl": null,
        "pod": null,
        "podDate": null,
        "podTime": null,
        "supplierId": "CitySprint",
        "subscriptionName": "",
        "voucherCode": null,
        "accountNumber": "W99969",
        "amount": {
          "total": "0.0",
          "vat": "0.0"
        },
        "store": {
          "storeId": "Store52",
          "retailerName": "Xyz store",
          "imageUrl": null,
          "address": {
            "firstLine": "House A",
            "secondLine": "Street B",
            "city": "Town C",
            "state": null,
            "postCode": "HA1 1JU",
            "country": null
          },
          "info": {
            "storeName": "Xyz store",
            "mobileNumber": "7777777777",
            "businessPhoneNumber": "7777777777",
            "website": "www.hello.com",
            "storeDesc": "A well known brand1",
            "userName": "xyz@citysprint.co.uk",
            "branchEmail": "xyzstore@mail.com",
            "branchInStoreTime": 30,
            "collectionLeadTime": null,
            "serviceCenterCode": "WO-SD",
            "accountType": "credit",
            "accountNumber": "W99969",
            "openTime": "10:15",
            "closeTime": "12:15",
            "openingHours": {
              "FRI": "11:00 - 18:00",
              "MON": "11:00 - 18:00",
              "SAT": "11:00 - 18:00",
              "SUN": "Closed",
              "THU": "11:00 - 18:00",
              "TUE": "11:00 - 18:00",
              "WED": "11:00 - 18:00"
            },
            "bankHolidayDetails": {
              "Boxing Day ": "12:00 - 17:00",
              "Christmas Day": "12:00 - 17:00",
              "Early May Bank Holiday": "12:00 - 17:00",
              "Easter Monday": "12:00 - 17:00",
              "Easter Sunday": "12:00 - 17:00",
              "Good Friday": "Closed",
              "New Years Day": "12:00 - 17:00",
              "Summer Bank Holiday": "12:00 - 17:00"
            },
            "service": null
          },
          "location": {
            "lat": "51.581163",
            "lng": "33.3456"
          },
          "knowMore": {
            "likeToBePartnerRetailer": 1,
            "storeType": 1,
            "havePortal": 1,
            "shippingDetail": 0,
            "instruction": null
          }
        },
        "timeslot": {
          "timeslotId": "43864-5u1c2ew4r08w",
          "startTime": "2016-02-05T15:00:00Z",
          "endTime": "2016-02-05T16:00:00Z"
        },
        "consumer": {
          "name": "test",
          "email": "xyzstore@mail.com",
          "instruction": "",
          "webhook": null,
          "mobileNumber": "7777777777",
          "address": {
            "firstLine": "House A",
            "secondLine": "Street B",
            "city": "Town C",
            "state": null,
            "postCode": "HA11JU",
            "country": ""
          }
        },
         "items": {
            "readyAt": "2016-04-11T13:20:00Z",
            "deliveryDate": "2016-04-11T00:00:00Z",
			"totalItemCount":"2"
			"totalItemWeight":"2"
            "item": [{
                "referenceNumber": "21"
                "itemContentCount": 2
                "totalValue": "0"
                "weight": 2
                "length": 2
                "width": 2
                "height": 2
                "description": "2 desc"
            }]
        },
        "serviceType": "Y1",
        "uuid": "a921737e-5d8d-4281-b376-7cb07be2e1f7",
        "referenceNo": "123",
        "departmentReferenceNo": "145"
      },
      "success": {
        "status": "ok"
      }
    }
                                                            
                                                                                                
                                                            
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
	//UUID
    define('UUID', '{{UUID}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/amendbooking');
    //time slotID
    define('TIME_SLOT_ID', '31220-c2e9sezbldcs');
    //booking ID
    define('orderNo', 17402835);
    //amend booking payload
    $data = array (
      'webhook' => '',
      'orderType' => '1',
      'supplierId' => 'CitySprint',
      'referenceNo' => '',
      'departmentReferenceNo' => '',
      'orderNo' => 17446103,
      'timeslot' => array (
        'timeslotId' => '43864-5u1c2ew4r08w',
      ),
      'store' => array (
        'storeId' => 'Store52',
        'instruction' => 'test',
        'info' => array (
          'openTime' => '10:15',
          'closeTime' => '12:15',
        ),
      ),
      'consumer' => array (
        'name' => 'test',
        'email' => 'test@test.com',
        'mobileNumber' => '7777777777',
        'address' => array (
          'firstLine' => 'House A',
          'secondLine' => 'Street B',
          'city' => 'Town C',
          'postCode' => 'HA11JU',
        ),
        'instruction' => '',
      ),
      'items' => array (
      'item'=>array(
        'referenceNumber' => '123456',
        'itemContentCount' => 1,
        'weight' => 0,
        'height' => 0,
        'length' => 0,
        'description' => '')
        
      ),
      'notificationType' => '',
    );
    //amend Booking API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
			"UUID: ".UUID,
            "Content-Type: application/json"
    );
    /**
     * This function will make call to amendBooking API and gets the response from the API
     * @param array $data payload for API
     * @param array $headers headers for API call
     * @return json response from API
     */
    function amendBooking(array $data, array $headers) {
        $ch = curl_init(API_URL);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call amendBooking
    $response = amendBooking($data, $headers);
    //API response
    if(is_array($response)){
        print_r( $response);
    }else{
        echo $response;
    }
                                                            
                                                                                                
                                                            
    {
       "data":{
          "timeslotId":"31220-c2e9sezbldcs",
          "bookingType":"Credit",
          "supplierId":"CitySprint",
          "accountNumber":"W99969",
          "serviceType":"Y0",
          "referenceNumber":"",
          "referenceNumber2":"",
          "store":{
             "storeId":"123",
             "instruction":"update booking"
          },
          "order":{
             "webhook":""
          },
          "consumer":{
             "isRegistered":"",
             "name":"test",
             "email":"xyzstore@mail.com",
             "mobileNumber":"7777777777",
             "address":{
                "firstLine":"House A",
                "secondLine":"Street B",
                "city":"Town C",
                "postCode":"HA11JU"
             },
             "instruction":""
          },
          "items": {
            "item": [{
                "referenceNumber": "21"
                "itemContentCount": 2
                "totalValue": "0"
                "weight": 2
                "length": 2
                "width": 2
                "height": 2
                "description": "2 desc"
            }],
        "readyAt": "2016-04-11T08:00:00Z"
            },
          "quote":{
             "vatAmount":"0.0",
             "total":"0.0"
          },
          "orderNo":"17402835"
       },
       "sucess":{
          "status":"ok"
       }
    }
                                                            
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	/**
	 *
	 * 

* An example that shows how to amend the bookings from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* */ public class AmendBooking { private static String host = "https://legacy-api.onthedot.com/api/v1.0/amendbooking"; private static String Channel = "ECOM"; private static String Authorization = "Authorization = Bearer {{API_KEY}}"; private String UUID = "{{UUID}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; // Not a mandatory, but used to identify from where does the request is // coming private static String userAgent = "Mozilla/5.0"; private static final int SUCCESS = 200; private static final int CREATED = 201; public static void main(String[] args) { try { System.out .println("-------------------Booking#Amend Booking-------------"); //please download the below json from https://s3-eu-west-1.amazonaws.com/otd-java-samples/otd-json-samples.rar and keep it in classpath // make sure that request payload has same timeslot id, storeId, // delivery city and account number // are same that were used during booking InputStream fileInputStream = Store.class.getClassLoader() .getResourceAsStream("amend-booking.json"); String fileContent = IOUtils.toString(fileInputStream); IOUtils.closeQuietly(fileInputStream); URL url = new URL(host); HttpURLConnection connection = (HttpURLConnection) url .openConnection(); // It is a HTTP PUT Call. connection.setRequestMethod("PUT"); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", contentType); connection.setRequestProperty("Content-Length", fileContent.length() + ""); // Following HTTP headers are mandatory: Authorization, Channel and // Accept. connection.addRequestProperty("Authorization", Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("UUID", UUID); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); DataOutputStream outStream = new DataOutputStream( connection.getOutputStream()); outStream.writeBytes(fileContent); outStream.flush(); outStream.close(); System.out.println("--------Response Status-------" + connection.getResponseCode()); BufferedReader in; if (SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); } else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("------------Response--------------"); System.out.println(response.toString()); } catch (IOException ioex) { ioex.printStackTrace(); } } }
                                            
	xhrRequest = new XMLHttpRequest();
	var amendData = {
		"orderType": "1",
		"supplierId": "CitySprint",
		"accountNumber": "OTDWO039",
		"serviceType": "Y2",
		"referenceNo": "123",
		"departmentReferenceNo": "2",
		"notificationType": "",
		"webHook": "",
		"orderNo": 17405725,
		"timeslot": {
			"timeslotId": "33012-2c6s4hrxyzvo"
		},
		"store": {
			"storeId": "dd8aaac3-f432-4286-a916-3137c8a079c9",
			"instruction": "",
			"info": {
				"openTime": "09:30",
				"closeTime": "18:00"
			}
		},
		"consumer": {
			"name": "1111111111",
			"email": "",
			"mobileNumber": "7777777777",
			"address": {
				"firstLine": "House A",
				"secondLine": "Street B",
				"city": "Town C",
				"postCode": "HA11JU"
			},
			"instruction": "eeeeeeeeeeeee"
		},
		"items": {
			"item": [{
					"referenceNumber": "21"
					"itemContentCount": 2
					"totalValue": "0"
					"weight": 2
					"length": 2
					"width": 2
					"height": 2
					"description": "2 desc"
				}],
			"readyAt": "2016-04-11T08:00:00Z"
		}
	};
	var url = 'https://legacy-api.onthedot.com/api/v1.0/amendbooking';
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);  //response
		}
	};
	xhrRequest.open("PUT", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("UUID", "{{UUID}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	var parsedValue = JSON.stringify(amendData);
	xhrRequest.send(parsedValue);
                                            
                                                                                

Cancel booking

To cancel a booking use the Cancel Booking API. This API cancels the booking that corresponds to the storeId and orderNo. Note that you can make changes to the booking only when the booking status is Booked or Amended.

Resource Properties
Resource URL https://<domain-name>/service/v1/cancelbooking/{:storeId}/{:orderNo}
HTTP Method DELETE
Resource type N/A
Response entity type N/A
Response format JSON
Request
Query parameters
no-links Not supported1
filter Not supported1
meta Not supported1
locale Not supported, Default ‘en’
page number Not supported1
1 This feature is not supported by the current version of the API
Path Param
storeId Retailer storeId
orderNo Job booking number
HTTP Headers
Authorization Required
Accept Optional
Channel Required
x-client-trans-id Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response
Response Header
Content-Type Required
Content-Length Required
x-client-trans-id Optional
Date Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response Fields
Name Type Description
orderNo String Booking number
status String Status of the booking
Exceptions and error codes
Status Error Id Error Code HTTP Code Description
Success ok 200 Request completes
Error EX-BK-001 BAD_REQUEST 404 Invalid booking status
Error EX-BK-002 BAD_REQUEST 404 Booking cancellation failed
Error BAD_REQUEST 404 Invalid orderNo
Error BAD_REQUEST 404 Invalid storeId
Generic Error
Error EX-AUTH-001 UNAUTHORIZED 401 Unauthorized, API key is not valid
Error EX-FORB-001 QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error EX-COMM-001 INTERNAL_SERVER_ERROR 500 Internal server error
Error EX-COMM-002 SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                            Response
                                            
    {
      errors:
        [
           {
              errorId: "EX-COMM-001",
              errorMessage: "Internal server error"
            }
        ]
    }
                                            
                                                                                
                                                    
    curl -X DELETE  https://legacy-api.onthedot.com/api/v1.0/cancelbooking/123/17402529 --header "Authorization: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json"
                                                    
                                                                                                
                                                    
    {
        "data": {
        "orderNo": "17445922",
        "status": "Cancelled"
      },
        "success": {
        "status": "ok"
      }
    }
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/cancelbooking/');
    //storeId
    define('STORE_ID', 123);
    //booking ID
    define('orderNo', 17402719);
    //Booking API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json"
    );
    /**
     * This function will make call to cancelBooking API and gets the response from the API
     * @param array $headers headers for API call
     * @return json response from API
     */
    function cancelBooking(array $headers) {
        $ch = curl_init(API_URL.STORE_ID.'/'.orderNo);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call cancelBooking
    $response = cancelBooking($headers);
    //API response
    if(is_array($response)){
         print_r( $response );
    }else{
        echo $response;
    }
                                                    
                                                                                                
                                                    
    {
        "data": {
        "orderNo": "17445922",
        "status": "Cancelled"
      },
        "success": {
        "status": "ok"
      }
    }
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to add,get and update bookings from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Booking { private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String CANCEL_BOOKING_URLSUFFIX="/api/v1.0/cancelbooking/"; private static final int SUCCESS=200; private static final int CREATED=201; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; //make sure that booking id belongs to storeId private static String orderNo="17399249"; public static void main(String[] args) throws IOException { //Cancel booking call cancelBooking(); } private static void cancelBooking() { try { System.out.println("------------------- Booking#cancelBookings------------"); URL url = getUrl(CANCEL_BOOKING_URLSUFFIX+STORE_ID+"/"+orderNo); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); setHttpHeaders(connection); connection.setRequestMethod("DELETE"); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var storeId = 'dd8aaac3-f432-4286-a916-3137c8a079c9'; //put your storeId here
	var orderNo = '17405725'; //put your job number here
	var url = 'https://legacy-api.onthedot.com/api/v1.0/cancelbooking/'+storeId+'/'+orderNo;
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);
		}
	};
	xhrRequest.open("DELETE", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	xhrRequest.send();
                                            
                                                                                

Get All Bookings

Returns the details of all the Bookings of a Store.

Resource properties
Resource URL
https://<domain-name>/service/v1/bookings/storeid/{:storeId}
HTTP Method GET
Resource type Collection
Response entity type Collection of booking
Response format JSON
Request
Query parameters
no-links Not supported1
filter Not supported1
how many Support
meta Not supported1
locale Not supported1
page number Support
sort by Support
sort order Support
1 This feature is not supported by the current version of the API
HTTP Headers
Authorization Required
Accept Optional
Channel Required
x-client-request-id Optional
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Path Param
storeId Identifier of the store
Response
Response Headers
Content-Type Optional
Content-Length Required
x-client-trans-id Optional
Date Required
Caller-Unique-Id Optional
ISOLang Optional
Locale Optional
TimeZone Optional
Response Content
Name Type Description
Bookings Collection of bookings All the booking in the form of a collection
booking Booking
UUID String UUID for which the booking is done
bookingType String
Valid value
Type of booking (Credit)
orderType String Type of booking Deliver
orderNo String Job booking number
orderReferenceNo String Booking reference number
orderDate String Order date
status String Status of the booking
trackingUrl String Live tracking URL of the booking
pod String Proof of delivery
podDate String Proof of delivery date
podTime String Proof of delivery time
serviceType String Y0
supplierId String To identify the external supplier using the time slot API for getting the time slot. Currently, this is populated with 'CitySprint'. Please do not change this unless specified by On the dot team
subscriptionName String Name of the subscription
voucherCode String Voucher identification
accountNumber String An optional field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
referenceNo String 12 char. field for customer reference. This is shown on invoices.
departmentReferenceNo String 30 char. field for customer references. This is shown on invoices.
amount
total String Total Amount of booking
vat String VAT for the booking
Store Store details
storeId String Unique storeId
retailerName String Name of the Retailer
imageUrl String Logo of the Retailer
address Store\address
firstLine String Address line 1 of the store
secondLine String Address line 2 of the store
city String City where store resides
state String State where store resides
postCode String Postcode of the store
country String Country where the store resides
info Store\info
storeName String Name of the store
mobileNumber String mobile number which belongs to store
businessPhoneNumber String Business phone number of the store
website String Website of the retailer/store
storeDesc String Description of the store
userName String Username provided by the retailer when store was registered
branchEmail String Store email address
branchInStoreTime Integer Time spent in store to collect the parcel
collectionLeadTime Integer Time taken to reach the store from the service center. By default this is 30 minutes
serviceCenterCode String Service center code
accountType String credit
accountNumber String Field that allows the retailer to specify an account number that has been supplied by CitySprint/On the dot
openTime String Opening time of the store during booking
closeTime String Closing time of the store
openingHours Map<String, String> Store open and close times for an entire week
bankHolidayDetails Map<String, String> Bank holidays of the store
service String A field that allows the customer to specify services that have been supplied by CitySprint/On the dot. Examples are 'T', 'V', MB and more
location Location
lat String Latitude of the store
lng String Longitude of the store
knowMore knowMore
likeToBePartnerRetailer String 0(NO) and 1(YES)
storeType String [1 store(0), 2 - 9 stores(1), 10 - 29 stores(2) and 30+ stores(3)] - Is Multi-store retailer or single store retailer
havePortal String Have website [ NO (0), Yes without ecom (1), Yes with ecom(2)]
shippingDetail String 0(NO) and 1(YES)
instruction String Store instruction
timeslot Timeslot object
timeslotId String Unique timeslot id
startTime ISO-8601 format (time in 00:00-24:00) Start time
For example 2016-03-01T15:00:00Z
endTime ISO-8601 format (time in 00:00-24:00) End time
For example 2016-03-01T16:00:00Z
consumer
name String Consumer name upto 20 char.(first name or last name)
email String Consumer email (Mandatory only when user is registered user)
mobileNumber String Consumer mobile number
Eg:(0)7XXXXXXXXX
instruction String Consumer instruction
webhook String Http url to which status of a job/booking is pushed from On the dot
consumer/address Consumer address
firstLine String Consumer first address line upto 60 char.
secondLine String Consumer second line upto 60 char.
city String Consumer City upto 60 char.
state String State where customer resides
postCode String Consumer postcode upto 20 char.
country String Country where customer resides
Items Items details
readyAt String Items ready from time
totalItemCount String Total combined count of all items
totalItemWeight String Total combined weight of all items
deliveryDate String Package delivery date. In case this is not given then would be considered as ‘readyAt’ date
item Items\item
referenceNumber String This is the unique barcode ID of the item/container to be couriered upto 30 char.
itemContentCount String Number of items for the booking
totalValue String Approximate cost of the package
weight Numeric Weight of the item
length Numeric Length of the item
width Numeric Width of the item
height Numeric Height of the item
description String Item description upto 60 char.
Exceptions and Error codes
Status Error Code HTTP Code Description
Success 200 Request completes
Error BOOKING_NOT_AVAILABLE 404 Booking not available
Generic error
Error UNAUTHORIZED 401 Unauthorized, API key is not valid
Error QUOTA_EXHAUSTED 403 Forbidden – quota exhausted
Error INTERNAL_SERVER_ERROR 500 Internal server error
Error SERVICE_UNAVAILABLE 503 Service not available
All the parameters in the request below should be replaced with the actual values.
                                                    
    curl -X GET https://legacy-api.onthedot.com/api/v1.0/bookings/storeid/123/?pageNumber=1&pageSize=25&sortBy=transactiondate&sortOrder=desc --header "Authorisation: Bearer {{API_KEY}}" --header "Channel: ECOM" --header "Content-Type: application/json"
                                                    
                                                                                                
                                                    
    {
    "data":{
       "data":[1]
         0: {
             "bookingType":"Credit",
             "orderType":"1",
             "orderNo":"17402529",
             "orderReferenceNo":"",
             "orderDate":"2015-09-30T17:18:53Z",
             "status":"Cancelled",
             "trackingUrl":null,
             "pod":null,
             "podDate":null,
             "podTime":null,
             "supplierId":"CitySprint",
             "subscriptionName":"",
             "voucherCode":"",
             "accountNumber":"W99969",
             "amount":{
                "total":"0.0",
                "vat":"0.0"
             },
             "store":{
                "storeId":"123",
                "retailerName":"Xyz store",
                "imageUrl":null,
                "address":{
                   "firstLine":"1 Rama Apartments",
                   "secondLine":"17 St. Anns Road",
                   "city":"Town C",
                   "state":null,
                   "postCode":"HA1 1JU",
                   "country":null
                },
                "info":{
                   "storeName":"Xyz store",
                   "mobileNumber":"7777777777",
                   "businessPhoneNumber":"7777777777",
                   "website":"www.hello.com",
                   "storeDesc":"A well known brand1",
                   "userName":"xyz@citysprint.co.uk",
                   "branchEmail":"xyzstore@mail.com",
                   "branchInStoreTime":30,
                   "collectionLeadTime":null,
                   "serviceCenterCode":"WO-SD",
                   "accountType":"credit",
                   "accountNumber":"W99969",
                   "openTime":null,
                   "closeTime":null,
                   "openingHours":{
                      "FRI":"11:00 - 18:00",
                      "MON":"11:00 - 18:00",
                      "SAT":"11:00 - 18:00",
                      "SUN":"Closed",
                      "THU":"11:00 - 18:00",
                      "TUE":"11:00 - 18:00",
                      "WED":"11:00 - 18:00"
                   },
                   "bankHolidayDetails":{
                      "Boxing Day ":"12:00 - 17:00",
                      "Christmas Day":"12:00 - 17:00",
                      "Early May Bank Holiday":"12:00 - 17:00",
                      "Easter Monday":"12:00 - 17:00",
                      "Easter Sunday":"12:00 - 17:00",
                      "Good Friday":"Closed",
                      "New Years Day":"12:00 - 17:00",
                      "Summer Bank Holiday":"12:00 - 17:00"
                   },
                   "service":null
                },
                "location":{
                   "lat":"51.581163",
                   "lng":"51.581163"
                },
                "knowMore":{
                   "likeToBePartnerRetailer":1,
                   "storeType":1,
                   "havePortal":null,
                   "shippingDetail":0,
                   "instruction":null
                }
             },
             "timeslot":{
                "timeslotId":"30781-2kiqgp5g3ou8",
                "startTime":null,
                "endTime":null,
             },
             "consumer":{
                "name":"test",
                "email":"xyzstore@mail.com",
                "instruction":"",
                "webhook":null,
                "mobileNumber":"7777777777",
                "address":{
                   "firstLine":"House A",
                   "secondLine":"Street B",
                   "city":"Town C",
                   "state":null,
                   "postCode":"HA11JU",
                   "country":""
                }
             },
             "items": {
                "item": [{
                "referenceNumber": "21"
                "itemContentCount": 2
                "totalValue": "0"
                "weight": 2
                "length": 2
                "width": 2
                "height": 2
                "description": "2 desc"
            }],
             "readyAt": "2016-04-11T08:00:00Z"
			 "deliveryDate": "2016-04-12T00:00:00Z"
			 "totalItemCount": "4",
             "totalItemWeight": "4"
    },
             "serviceType":"Y0",
             "uuid":"f335084e-af4c-49c2-9396-e08b5ef69294"
             "referenceNo": "123",
        "departmentReferenceNo": "145"
          },
       "size":1
       "success":{
          "status":"ok"
       }
    }
                                                    
                                                                                                
                                                    
    <?php
    //API KEY
    define('API_KEY', '{{API_KEY}}');
    //API URL
    define('API_URL', 'https://legacy-api.onthedot.com/api/v1.0/bookings/storeid/');
    //storeId
    define('STORE_ID', 123);
    //Get Bookings API Call headers
    $headers = array(
            "Authorization: Bearer ".API_KEY,
            "Channel: ECOM",
            "Content-Type: application/json"
    );
    /**
     * This function will make call to getBookings API and gets the response from the API
     * @param array $headers headers for API call
     * @return json response from API
     */
    function getBookings(array $headers) {
        $ch = curl_init(API_URL.STORE_ID);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_HTTPHEADER,  $headers );
        $result = curl_exec($ch);
        if(curl_errno($ch))
        {
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    //call getBookings
    $response = getBookings($headers);
    //API response
    if(is_array($response)){
        print_r( json_decode($response) );
    }else{
        echo $response;
    }
                                                    
                                                                                                
                                                    
    {
    "data":{
       "data":[1]
         0: {
             "bookingType":"Credit",
             "orderType":"1",
             "orderNo":"17402529",
             "orderReferenceNo":"",
             "orderDate":"2015-09-30T17:18:53Z",
             "status":"Cancelled",
             "trackingUrl":null,
             "pod":null,
             "podDate":null,
             "podTime":null,
             "supplierId":"CitySprint",
             "subscriptionName":"",
             "voucherCode":"",
             "accountNumber":"W99969",
             "amount":{
                "total":"0.0",
                "vat":"0.0"
             },
             "store":{
                "storeId":"123",
                "retailerName":"Xyz store",
                "imageUrl":null,
                "address":{
                   "firstLine":"1 Rama Apartments",
                   "secondLine":"17 St. Anns Road",
                   "city":"Town C",
                   "state":null,
                   "postCode":"HA1 1JU",
                   "country":null
                },
                "info":{
                   "storeName":"Xyz store",
                   "mobileNumber":"7777777777",
                   "businessPhoneNumber":"7777777777",
                   "website":"www.hello.com",
                   "storeDesc":"A well known brand1",
                   "userName":"xyz@citysprint.co.uk",
                   "branchEmail":"xyzstore@mail.com",
                   "branchInStoreTime":30,
                   "collectionLeadTime":null,
                   "serviceCenterCode":"WO-SD",
                   "accountType":"credit",
                   "accountNumber":"W99969",
                   "openTime":null,
                   "closeTime":null,
                   "openingHours":{
                      "FRI":"11:00 - 18:00",
                      "MON":"11:00 - 18:00",
                      "SAT":"11:00 - 18:00",
                      "SUN":"Closed",
                      "THU":"11:00 - 18:00",
                      "TUE":"11:00 - 18:00",
                      "WED":"11:00 - 18:00"
                   },
                   "bankHolidayDetails":{
                      "Boxing Day ":"12:00 - 17:00",
                      "Christmas Day":"12:00 - 17:00",
                      "Early May Bank Holiday":"12:00 - 17:00",
                      "Easter Monday":"12:00 - 17:00",
                      "Easter Sunday":"12:00 - 17:00",
                      "Good Friday":"Closed",
                      "New Years Day":"12:00 - 17:00",
                      "Summer Bank Holiday":"12:00 - 17:00"
                   },
                   "service":null
                },
                "location":{
                   "lat":"51.581163",
                   "lng":"51.581163"
                },
                "knowMore":{
                   "likeToBePartnerRetailer":1,
                   "storeType":1,
                   "havePortal":null,
                   "shippingDetail":0,
                   "instruction":null
                }
             },
             "timeslot":{
                "timeslotId":"30781-2kiqgp5g3ou8",
                "startTime":null,
                "endTime":null,
             },
             "consumer":{
                "name":"test",
                "email":"xyzstore@mail.com",
                "instruction":"",
                "webhook":null,
                "mobileNumber":"7777777777",
                "address":{
                   "firstLine":"House A",
                   "secondLine":"Street B",
                   "city":"Town C",
                   "state":null,
                   "postCode":"HA11JU",
                   "country":""
                }
             },
             "items": {
                "item": [{
                "referenceNumber": "21"
                "itemContentCount": 2
                "totalValue": "0"
                "weight": 2
                "length": 2
                "width": 2
                "height": 2
                "description": "2 desc"
            }],
             "readyAt": "2016-04-11T08:00:00Z"
			 "deliveryDate": "2016-04-12T00:00:00Z"
    },
             "serviceType":"Y0",
             "uuid":"f335084e-af4c-49c2-9396-e08b5ef69294"
             "referenceNo": "123",
        "departmentReferenceNo": "145"
          },
       "size":1
       "success":{
          "status":"ok"
       }
    }
                                                    
                                                                                                
                                            
	package uk.co.citysprint.sample;
	import java.io.BufferedReader;
	import java.io.DataOutputStream;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.net.HttpURLConnection;
	import java.net.MalformedURLException;
	import java.net.URL;
	import org.apache.commons.io.IOUtils;
	import org.apache.commons.lang.StringUtils;
	/**
	 *
	 * 

* An example that shows how to add,get and update bookings from Onthedot server. *

* *

* Prerequisites: An account/ subscription with Onthedot, Java 1.7 or newer, Apache HttpComponents v4.5 or * newer *

* *

* With Onthedot account/ * subscription you must have received Authorization token and Channel keys. *

* * * @author M.R.Sharma * @version 1.0 * @since Wed, 26 Aug, 2015 */ public class Booking { private static String host="https://legacy-api.onthedot.com"; private static String Channel="ECOM"; private static String Authorization="Authorization = Bearer {{API_KEY}}"; // Onthedot server deals only with JSON. private static String Accept = "application/json"; // Onthedot server deals only with JSON. private static String contentType = "application/json"; //Not a mandatory, but used to identify from where does the request is coming private static String userAgent = "Mozilla/5.0"; private static String GET_BOOKINGS_URLSUFFIX="/api/v1.0/bookings/storeid"; private static final int SUCCESS=200; private static final int CREATED=201; //This storeId only a sample ,make sure you have a valid storeId which is used during store creation private static String STORE_ID="123"; //make sure that booking id belongs to storeId private static String orderNo="17399249"; public static void main(String[] args) throws IOException { //Get the list of bookings that were made for a particular storeId getBookings(); } private static void getBookings() { try { System.out.println("------------------- Booking#getBookings------------"); URL url = getUrl(GET_BOOKINGS_URLSUFFIX+STORE_ID); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); setHttpHeaders(connection); connection.setRequestMethod("GET"); print(connection); } catch (IOException ioex) { ioex.printStackTrace(); } } /** * Method establishes connection, gets the response and prints the response * @param connection * @throws IOException */ private static void print(HttpURLConnection connection) throws IOException { System.out.println("-----------Response Status----------" + connection.getResponseCode()); BufferedReader in; if(SUCCESS == connection.getResponseCode() || CREATED == connection.getResponseCode()) { in = new BufferedReader(new InputStreamReader( connection.getInputStream())); }else { in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); } String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("---------Response-----------"); System.out.println(response.toString()); } /** * Method construct the url instance, by appending host provided in config file with the given String * @param hostSuffix * @return * @throws MalformedURLException */ private static URL getUrl(String hostSuffix) throws MalformedURLException { if ((!host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + "/" + hostSuffix); } else if ((!host.endsWith("/")) && (hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { if ((host.endsWith("/")) && (!hostSuffix.startsWith("/"))) { return new URL(host + hostSuffix); } else { return new URL(host + StringUtils.removeStart(hostSuffix, "/")); } } } private static void setHttpHeaders(HttpURLConnection connection) { connection.addRequestProperty("Authorization",Authorization); connection.addRequestProperty("Channel", Channel); connection.addRequestProperty("Accept", Accept); connection.addRequestProperty("User-Agent", userAgent); } }
                                            
	xhrRequest = new XMLHttpRequest();
	var storeId = 'dd8aaac3-f432-4286-a916-3137c8a079c9'; //put your storeId here
	var url = 'https://legacy-api.onthedot.com/api/v1.0/bookings/storeid/'+storeId;
	xhrRequest.onreadystatechange = function() {
		if (xhrRequest.readyState == 4 && xhrRequest.status == 200) {
			console.log(xhrRequest.responseText);
		}
	};
	xhrRequest.open("GET", url, true);
	xhrRequest.setRequestHeader("Content-Type", "application/json");
	xhrRequest.setRequestHeader("Authorization", "Bearer {{API_KEY}}");
	xhrRequest.setRequestHeader("Channel", "ECOM");
	xhrRequest.send();
                                            
                                                                                

Retrieve booking

This fetches the booking based on the booking ID.

Resource properties
Resource URL
https:///service/v1.0/bookings/orderid/{:storeId}/{orderNo}
HTTP Method GET
Resource type Record
Response entity type booking
Response format JSON