Creating a New Location

To create a new location we need to do a POST request to /locations with the application/json content-type request header and a JSON object containing the specified properties in the request body.

Properties

Name Mandatory Type Length Example
storeId true string 36 "030HHE"
storeName true string 128 "Haywards Heath"
supplementaryName false string 128 "Provider Store #10"
structuredAddress cond (*1) object
structuredAddress.street true string 256 Commercial Square
structuredAddress.buildingName false string 64 Palmerston House
structuredAddress.houseNumber false string 64 4
structuredAddress.city true string 64 London
structuredAddress.district false string 64 Greater London
structuredAddress.province false string 64 Hogwarts
structuredAddress.postCode true string 16 RH16 1DR
structuredAddress.countryCode true string 16 GBR
city cond string 64 "London"
postCode cond string 16 "RH16 1DR"
countryCode cond string (*2) 3 "GBR"
address cond string 256 "4 Palmerston House; Commercial Square"
latitude true signed floating point number 11,8 51.006035
longitude true signed floating point number 11,8 -0.102897
locationProvider.id true UUID (*3) - "2a2b72ca-980b-4c24-8e33-a26b2820a3db"
telephoneNumber false string 16 "+44 7894 465 4561"
email false string 127(*4) "test@metapack.com"
logoUrl false string 128 "http://logodomain.com/nicelogo.jpg"
photoUrls false string 512 "http://logodomain.com/nicephoto1.jpg,http://logodomain.com/nicephoto2.jpg"
hasDisabledAccess false boolean - true
description false string 512 "Nice Store"
tags false string array - ["a","b","c"]
translations false map<string,translation>(*5) - -

Notes

  1. Structured address (structuredAddress.*) fields are mutually exclusive with address, city, postCode, countryCode
  2. Valid 3 character / 2 character / 3 digit country code
  3. Existing Location Provider identifier
  4. Must be a well-formed email address. Both local part and domain part of the email address are limited to 63 characters.
  5. See Translations

Required Permission

can-create-locations

See Auth* (scopes).

Request

Structured Address Format

POST /locations
Content-Type: application/json
{
   "storeId": "001MKC",
   "storeName": "Milton Keynes",
   "supplementaryName": "Nice Store 1",
   "structuredAddress": {
     "street": "Elder Gate",
     "buildingName": "DODO Estate",
     "houseNumber": "202",
     "city": "Milton Keynes",
     "district": "Greater London",
     "province": "Hogwarts",
     "postCode": "MK9 1GW",
     "countryCode": "GBR"
   },
   "latitude":52.035538,
   "longitude":-0.774214,
   "telephoneNumber": "+441908237494",
   "email": "mkstore@askjeeves.com",
   "tags":[ "a", "b", "c" ],
   "locationProvider": { "id": "2a2b72ca-980b-4c24-8e33-a26b2820a3db" }
}

Legacy Address Format

POST /locations
Content-Type: application/json
{
   "storeId":"001MKC",
   "storeName":"Milton Keynes",
   "city":"Milton Keynes",
   "postCode":"MK9 1GW",
   "countryCode":"GBR",
   "address":"202 Elder Gate",
   "latitude":52.035538,
   "longitude":-0.774214,
   "telephoneNumber":"+441908237494",
   "email":"mkstore@askjeeves.com",
   "tags":[
       "a",
       "b",
       "c"
   ],
   "locationProvider":{
      "id":"2a2b72ca-980b-4c24-8e33-a26b2820a3db"
   }
}

Response

HTTP/1.1 201 CREATED
{
   "rel":"self",
   "href":"/locations/c06c2305-1b33-43d2-8695-72a88a9cda61"
}

Failure

Request error; e.g. invalid JSON object:

HTTP/1.1 400 BAD REQUEST
{
   "error":"Invalid property: 'addr ess'"
}

User doesn't have the required permission:

HTTP/1.1 403 FORBIDDEN

Other errors:

HTTP/1.1 500 INTERNAL SERVER ERROR

results matching ""

    No results matching ""