Creating a Store

Request

Before proceeding, ensure that you have your Location Provider ID (refer to Preparation).

Perform a POST request to:

https://dmo.metapack.com/locations

of content type:

application/json

with the following authorisation (the token is copied from the access_token field that is returned from Generating a Bearer Token):

Bearer <Bearer Token>

Note

The token must be within its TTL and associated with a can-create-locations permission.

The body should contain the fields shown in the following example:

{
   "storeId": "001MKC",
   "storeName": "Milton Keynes",
   "supplementaryName": "Nice Store 1",
   "structuredAddress": {
     "street": "Elder Gate",
     "buildingName": "DODO Estate",
     "houseNumber": "202",
     "city": "Milton Keynes",
     "district": "Central Bletchley",
     "province": "Buckinghamshire",
     "postCode": "MK9 1GW",
     "countryCode": "GBR"
   },
   "latitude": 52.043200,
   "longitude": -0.761790,
   "telephoneNumber": "+441908237494",
   "email": "mkstore@askjeeves.com",
   "logoUrl": "http://logo.metapack.com/testlogo.gif",
   "photoUrls": [
    "http://logo.metapack.com/testlogo.gif",
    "http://logo.metapack.com/testlogo.gif"
  ],
  "hasDisabledAccess": true,
  "description": "Our Bletchley Store",
  "id": "<Location ID>",
  "tags":[ "a", "b", "c" ],
  "locationProvider": { "id": "<Location Provider ID>" }
}

The properties for the body fields are as follows:

Table 2. Body Field Properties

Field Name

Mandatory?

Type

Length

Example

storeId

Yes

string

36

"01WESTMINSTER"

storeName

Yes

string

128

"Westminster Square"

supplementaryName

No

string

128

"Provider Store #10"

structuredAddress

You only need to specify the structuredAddress fields immediately below if you are not specifying address, city, postCode and countryCode.

object containing the structuredAddress fields below.

structuredAddress .street

Yes

string

256

"Westminster Square"

structuredAddress .buildingName

No

string

64

"Palmerston House"

structuredAddress .houseNumber

No

string

64

"126"

structuredAddress .city

Yes

string

64

"London"

structuredAddress .district

No

string

64

"Westminster"

structuredAddress .province

No

string

64

"Greater London"

structuredAddress .postCode

Yes

string

16

"SE1 7UW"

structuredAddress .countryCode

Yes

string

16

GBR

city

Mandatory if you have not specified structuredAddress.city.

string

64

"London"

postCode

Mandatory if you have not specified structuredAddress .postCode.

string

16

"SE1 7UW"

countryCode

Mandatory if you have not specified structuredAddress .countryCode.

string

3

GBR

address

Mandatory if you have not specified the respective structuredAddress fields.

string

256

"126 Palmerston House, Westminster Square"

latitude

Yes

double precision floating point number

11,8

"51.499240"

longitude

Yes

double precision floating point number

11,8

"-0.113020"

telephoneNumber

No

string

16

"+44 20 7946 0234"

email

No

string

Both the local and domain parts of the email address are limited to 63 characters.

127

"test@metapack.com"

logoUrl

No

URL

128

"http://logodomain.com /nicelogo.jpg"

photoUrls

No

URL(s) (comma separated)

512

"http://logodomain.com /nicephoto1.jpg, http://logodomain.com /nicephoto2.jpg"

hasDisabledAccess

No

boolean

N/A

true

description

No

string

512

"Nice Store"

tags

No

string array

N/A

["pharmacy","refrigerated" ,"potato"]

translations

No

map<string,translation ,string,translation> - up to 10 translations.

The key for the map must be an ISO 639-1 two-letter code in lowercase.

N/A

"translations": {
    "nl": {
      "storeName": "DAGBL L ESCAUT MOLENBEEK",
      "structuredAddress": {
        "street": "JUBELFEESTLAAN",
        "houseNumber": "202",
        "city": "SINT-JANS-MOLENBEEK"
      }

locationProvider.id

Yes

UUID of existing location provider (refer to Preparation).

ID

"2a2b79ca-980b-4c24- 8e34-a26b2821a3db"


Response

The response from Delivery Options is in JSON format, and will be in the form of an HTTP 201 CREATED response if the request is successful. For other possible responses, refer to What are the possible Server Responses?.

A successful response will return the location ID, for example:

{
   "rel":"self",
   "href":"/locations/<Location ID>"
}

Setup Checklist

  1. Generating a Bearer Token

  2. Creating a Store

  3. Adding a Store's Opening Times