API for delivery areas

For developers.
Questions, send a mail to: it-support@besttransport.se

Base url : https://api.besttransport.se/api/v2/

Base url for testing: https://staging.besttransport.se/api/v2/

Functionality in the API

  • The possibility to send a request for a delivery to a specific zip code. The response will let you know if we deliver to that zip code and when the first possible delivery date is to that zip code, depending on what time of day it is at the time for the request. In the response you will get additional four possible delivery dates.
  • The possibility to get the complete package of delivery areas. Including zip codes, sorting codes, cut-off time for orders and the last day for orders that are to be delivered on saturday och sundays where that is an option


Authentication
With API-key or with a uniqe certificate that is included in the header. X-Customer-Identifier = ID for the Place of pick up or time for pick up. for wich the request is made. ID is defined at the time of set up.

Sample cod (Python)

headers = {

"X-API-Token": "secrettoken",

"X-Customer-Identifier": "customerspecificId"

}


Sample code: request for delivery options for specific Zip code in Sweden (SE) 19276 (Python)

headers = {

"X-API-Token": "secrettoken",

"X-Customer-Identifier": "UPPH1"

}

r = requests.get("https://api.besttransport.se/api/v2/deliverydates/SE/19276", headers=headers)

print(r.content)

API-respons:
b'{"pickup": "2021-07-05T11:00:00+00:00", "date": "2021-07- 06", "window": "17:00:00-22:00:00", "zip": "19276", "city": "Sollentuna", "sort_code": "3-STO-NN-232", "environment": "C", "dates": [{"date": "2021-07-06", "window": "17:00:00-22:00:00"}, {"date": "2021-07-07", "window": "17:00:00-22:00:00"}, {"date": "2021-07-08", "window": "17:00:00-22:00:00"}, {"date": "2021-07-09", "window": "17:00:00-22:00:00"}, {"date": "2021-07-10", "window": "17:00:00-22:00:00"}]}'

pickup: Date and time when the goods are to be picked up by Best Transport

date: The next available date for delivery

window: Delivery window

zip: Zip code

city: The city which the zip code belongs to

sort_code: Sorting code to be printed on the label for the specific zip code

environment: C = Climate compensated, F = Fossil free

dates: The next available delivery date plus four additional dates that is available for delivery

date: The next available date for delivery

Sample code: request to get the complete list of delivery areas in Sweden (SE) (Python)

headers = {

"X-API-Token": "secrettoken",

"X-Customer-Identifier": "UPPH1"

}

print(r.content)r = requests.get("https://api.besttransport.se/api/v2/deliverydates/SE", headers=headers)

API-response (extract)

b'[{"zip": "78161", "city": "Gustafs", "sort_code": "3-BLG-1", "days": 1, "environment": "C", "cutoff": [{"day": 1, "cut-off-day": 1, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 2, "cut-off-day": 2, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 3, "cut-off-day": 3, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 4, "cut-off-day": 4, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 5, "cut-off-day": 5, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 6, "cut-off-day": null, "cut-off-time": "", "window": "17:00:00-22:00:00"}, {"day": 7, "cut-off-day": null, "cut-off-time": "", "window": "17:00:00-22:00:00"}]}, {"zip": "78168", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "days": 1, "environment": "C", "cutoff": [{"day": 1, "cut-off-day": 1, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 2, "cut-off-day": 2, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 3, "cut-off-day": 3, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 4, "cut-off-day": 4, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 5, "cut-off-day": 5, "cut-off-time": "13:00", "window": "17:00:00-22:00:00"}, {"day": 6, "cut-off-day": null, "cut-off-time": "", "window": "17:00:00-22:00:00"}, {"day": 7, "cut-off-day": null, "cut-off-time": "", "window": "17:00:00-22:00:00"}]},

zip: Zip code

city: The city which the zip code belongs to

sort_code: Sorting code to be printed on the label for the specific zip code

days: Number of days until delivery if ordered before cut-off time

environment: C = Climate compensated, F = Fossil free

cut-off: Available delivery days displayed in the following way;

day: 1 = Monday, 2= Tuesday etc.

cut-off-day: 1 = Monday, 2= Tuesday etc.

cut-off-time: Time of day when possible delivery is moved to the next available day

window: Delivery window

API to just get Best Transports delivery zones (usually used when there is no need to get a specific delivery date from the API)

Base url: https://api.besttransport.se/api/v2/

Functionality in the API

  • The possibility to get the complete package of delivery areas. Including zip codes, sorting codes or just check if one specific zip code is within Best Transports delivery area

Authentication

With API-key or with a unique certificate that is included in the header. X-Customer-Identifier = ID for the Place of pick up or time for pick up. for which the request is made. ID is defined at the time of set up.

Sample cod (Python)

import requests

headers = {"X-API-Token": "secrettoken",

"X-Customer-Identifier": "UPPH1"}

r = requests.get("https://api.besttransport.se/api/v2/deliveryzones/SE/19276", headers=headers)

print(r.content)

Response from the API

b'{"zip": "19276", "city": "Sollentuna", "sort_code": "3-STO-NN-232", "environment": "F"}'

zip: Zip code

city: The city which the zip code belongs to

sort_code: Sorting code to be printed on the label for the specific zip code

environment: C = Climate compensated, F = Fossil free

Sample code: request to get the complete list of delivery areas in Sweden (SE) (Python)

import requests

headers = {"X-API-Token": "secrettoken",

"X-Customer-Identifier": "UPPH1"}

r = requests.get("https://api.besttransport.se/api/v2/deliveryzones/SE", headers=headers)

print(r.content)

API-response (extract)

b'[{"zip": "78161", "city": "Gustafs", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78168", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78170", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78171", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78172", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78173", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78174", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78190", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-2", "environment": "C"}, {"zip": "78192", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78193", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78430", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78431", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78432", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78433", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78434", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"}, {"zip": "78435", "city": "Borl\\u00e4nge", "sort_code": "3-BLG-1", "environment": "C"},

zip: Zip code

city: The city which the zip code belongs to

sort_code: Sorting code to be printed on the label for the specific zip code

environment: C = Climate compensated, F = Fossil free