Skip to main content

Depot

Introduction

Using Geo2 API, you can:

  • Create depot (POST /depot)
  • Get depot data (GET /depot and GET /depots)
  • Delete load (DELETE /depot)

For each of the actions above we have examples of how it works, which data you need to put in the request body, and what a result would be.

Create Depot

To create a depot you need to send a POST request with the next parameters:

ParametersTypeDescriptionRequired
keystringDepot identifier which is required to be unique within the environment.  For example, Depot 1.Yes
namestringUser-definable depot name to describe a depot, for example, Storage for materials.  It is for internal usage only.Yes
addressYes
namestringUser-defined description useful if addresses are shown as an address book.No
companystringCompany name as a part of a depot address, e.g. "Springboard Applications Ltd".No
line1stringDepot address line, typically street, e.g. "1000 Great West Road".Yes
line2stringNo
line3stringNo
citystringCity of a depot, e.g. "Brentford".Yes
regionstringRegion of a depot.No
postalCodestringPostal code of a depot.No
statestringName of state of a depot.No
countrystringCountry of a depot. Must be set, 2-letter ISO code.  For example, GB for the United Kingdom, or US for the United States.Yes
geoLocationgeopointGeo-location of a geo-coded address.No
latitudeNo
longtitudeNo
geoLocationAccuracyunsigned intGoogle equivalents:
1 - ROOFTOP
2 - RANGE_INTERPOLATED, GEOMETRIC_CENTER
3 - APPROXIMATE
No
placeIdstringGoogle Places API Place IDNo
contactNo
personNamestringContact name, e.g. "John Doe"No
emailstringEmail address of the depot.No
phone
codestringCode of country, like "GB".No
countryCodeunsigned intE.g. 44 for the GB.No
localNumberunsigned intThe remainder of the number, without a leading zero.No
mobile
codestringCode of country, like "GB".No
countryCodeunsigned intE.g. 44 for the GB.No
localNumberunsigned intThe remainder of the number, without a leading zero.No

Example of a POST request to create a depot:

Request

curl -X 'POST' \
'https://api.geo2.com/v1/depot' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJtaWNyb3NvZnQ6M2VhOGVhODItOTNmZC00NmNhLTk3ODItNjhkNzMxODg4OWEzIiwidG9rZW5JZCI6Ii1OUXlFa1pTWm9Ic3Y5OEg1RlIyIiwiaWF0IjoxNjc5MzAyNzg5LCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcHJqLXByby1iYWxkZXYtZ2VvMiIsInN1YiI6Im1pY3Jvc29mdDozZWE4ZWE4Mi05M2ZkLTQ2Y2EtOTc4Mi02OGQ3MzE4ODg5YTMiLCJhdWQiOiJwcmotcHJvLWJhbGRldi1nZW8yIiwiZXhwIjoxOTk0NjYyNzg5fQ.G3LaRxJJJhYlG-m1GHvP9ZgB39Sxh0H98m5AHI2hfDM' \
-H 'Content-Type: application/json' \
-d '{
"key": "depot_001",
"name": "TEST DEPOT",
"address": {
"name": "Office",
"company": "Balloonone",
"line1": "The Mille",
"line2": "Great West Rd",
"line3": "",
"city": "Brentford",
"region": "",
"postalCode": "TW8 9DW",
"state": "",
"country": "GB",
"geoLocation": {
"lat": 51.488922406204296,
"lng": -0.3134162798480503
},
"geoLocationAccuracy": 1,
"placeId": "ChIJUfCccbwNdkgRZun6nuRQ1tY"
},
"contact": {
"personName": "Nick",
"email": "nick@balloonone.com",
"phone": {
"code": "GB",
"countryCode": "44",
"localNumber": "2088199071"
},
"mobile": {
"code": "GB",
"countryCode": "44",
"localNumber": "2088199071"
}
}
}'

Example of a response after sending a request:

Response

{
"status": "OK"
}

If a response status is OK, a depot is created. It is also shown in the Depots tab in Hub: Depots Settings in Hub.

Get Depot Data

To return all depots for an environment, you need to send a GET/depots request.  Example:

Request

curl -X 'GET' \
'https://api.geo2.com/v1/depots' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJtaWNyb3NvZnQ6M2VhOGVhODItOTNmZC00NmNhLTk3ODItNjhkNzMxODg4OWEzIiwidG9rZW5JZCI6Ii1OUXlFa1pTWm9Ic3Y5OEg1RlIyIiwiaWF0IjoxNjc5MzAyNzg5LCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcHJqLXByby1iYWxkZXYtZ2VvMiIsInN1YiI6Im1pY3Jvc29mdDozZWE4ZWE4Mi05M2ZkLTQ2Y2EtOTc4Mi02OGQ3MzE4ODg5YTMiLCJhdWQiOiJwcmotcHJvLWJhbGRldi1nZW8yIiwiZXhwIjoxOTk0NjYyNzg5fQ.G3LaRxJJJhYlG-m1GHvP9ZgB39Sxh0H98m5AHI2hfDM'

Example of a response after sending a request:

Response

{
"data": [
{
"address": {
"country": "GB",
"geoLocation": {
"lng": -0.6589784,
"lat": 51.9068365
},
"city": "Leighton Buzzard",
"postalCode": "LU7 4WG",
"placeId": "ChIJCahEnDBRdkgRTgjGG9r84M8",
"company": "test",
"geoLocationAccuracy": 1,
"region": "Bedfordshire",
"line2": "Chartmoor Rd",
"line1": "Unit 7"
},
"contact": {
"personName": "John",
"phone": {
"code": "GB",
"countryCode": "44",
"localNumber": "1234567890"
},
"mobile": {
"code": "GB",
"countryCode": "44",
"localNumber": "1234567890"
},
"email": "john.doe@gmail.com"
},
"name": "TEST DEPOT",
"key": "depot_001"
},
{
"address": {
"country": "GB",
"city": "Brentford",
"postalCode": "TW8 9DW",
"placeId": "ChIJUfCccbwNdkgRZun6nuRQ1tY",
"geoLocationAccuracy": 1,
"geoLocation": {
"lng": -0.3134162798480503,
"lat": 51.488922406204296
},
"name": "Office",
"company": "Balloonone",
"state": "",
"line3": "",
"region": "",
"line2": "Great West Rd",
"line1": "The Mille"
},
"contact": {
"personName": "Nick",
"phone": {
"code": "GB",
"countryCode": "44",
"localNumber": "2088199071"
},
"mobile": {
"code": "GB",
"countryCode": "44",
"localNumber": "2088199071"
},
"email": "nick@balloonone.com"
},
"name": "TEST DEPOT 2",
"key": "depot_002"
}
],
"status": "OK"
}

To get data about only one certain depot, you need to send a GET /depot request.  You can use a depot key.  Example:

Request

curl -X 'GET' \
'https://api.geo2.com/v1/depot?key=test' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJtaWNyb3NvZnQ6M2VhOGVhODItOTNmZC00NmNhLTk3ODItNjhkNzMxODg4OWEzIiwidG9rZW5JZCI6Ii1OUXlFa1pTWm9Ic3Y5OEg1RlIyIiwiaWF0IjoxNjc5MzAyNzg5LCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcHJqLXByby1iYWxkZXYtZ2VvMiIsInN1YiI6Im1pY3Jvc29mdDozZWE4ZWE4Mi05M2ZkLTQ2Y2EtOTc4Mi02OGQ3MzE4ODg5YTMiLCJhdWQiOiJwcmotcHJvLWJhbGRldi1nZW8yIiwiZXhwIjoxOTk0NjYyNzg5fQ.G3LaRxJJJhYlG-m1GHvP9ZgB39Sxh0H98m5AHI2hfDM'

Example of a response after sending a request:

Response

{
"data": {
"address": {
"country": "GB",
"geoLocation": {
"lng": -0.6589784,
"lat": 51.9068365
},
"city": "Leighton Buzzard",
"postalCode": "LU7 4WG",
"placeId": "ChIJCahEnDBRdkgRTgjGG9r84M8",
"company": "test",
"geoLocationAccuracy": 1,
"region": "Bedfordshire",
"line2": "Chartmoor Rd",
"line1": "Unit 7"
},
"contact": {
"personName": "John",
"phone": {
"code": "GB",
"countryCode": "44",
"localNumber": "1234567890"
},
"mobile": {
"code": "GB",
"countryCode": "44",
"localNumber": "1234567890"
},
"email": "john.doe@gmail.com"
},
"name": "TEST DEPOT",
"key": "depot_001"
},
"status": "OK"
}

Delete Depot

To delete a depot you can use a depot key.  After filling in a depot key, you need to send a DELETE request.  Example:

Request

curl -X 'DELETE' \
'https://api.geo2.com/v1/depot?key=test' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJtaWNyb3NvZnQ6M2VhOGVhODItOTNmZC00NmNhLTk3ODItNjhkNzMxODg4OWEzIiwidG9rZW5JZCI6Ii1OUXlFa1pTWm9Ic3Y5OEg1RlIyIiwiaWF0IjoxNjc5MzAyNzg5LCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcHJqLXByby1iYWxkZXYtZ2VvMiIsInN1YiI6Im1pY3Jvc29mdDozZWE4ZWE4Mi05M2ZkLTQ2Y2EtOTc4Mi02OGQ3MzE4ODg5YTMiLCJhdWQiOiJwcmotcHJvLWJhbGRldi1nZW8yIiwiZXhwIjoxOTk0NjYyNzg5fQ.G3LaRxJJJhYlG-m1GHvP9ZgB39Sxh0H98m5AHI2hfDM'

Example of a response after sending a request:

Response

{
"status": "OK"
}

A depot will be deleted from Hub as well.