The examples in the previous section return inventory data for the default inventory location (the online-only store). To maintain inventory for individual physical stores, you must represent them in Oracle Commerce Cloud by creating new locations.

You can use the createLocation endpoint to create a new location. You specify information about the location in the body of the request. For example:

POST /ccadmin/v1/locations HTTP 1.1
Authorization: Bearer <access_token>

{
  "externalLocationId": "107",
  "hours": "9:00am - 5:00pm",
  "locationId": "Cambridge_MA",
  "address1": "221 Main Street",
  "type": "store",
  "country": "USA",
  "city": "Cambridge",
  "faxNumber": "(617) 386-1200",
  "postalCode": "02141",
  "phoneNumber": "(617) 386-1200",
  "email": "store107@example.com",
  "stateAddress": "MA",
  "county": "Middlesex",
  "name": "Cambridge MA -- Kendall Square",
  "longitude": -71.0901,
  "latitude": 42.3629
}

You must supply a value for the name property. If you omit locationId (the property used to identify the location in REST API calls), a value is automatically supplied. If you omit other properties, their values will be null.

The endpoint returns the location information in the response body:

{
    "externalLocationId": "107",
    "startDate": null,
    "locationId": "Cambridge_MA",
    "address1": "221 Main Street",
    "address2": null,
    "endDate": null,
    "address3": null,
    "type": "store",
    "city": "Cambridge",
    "distance": null,
    "postalCode": "02141",
    "faxNumber": "(617) 386-1200",
    "phoneNumber": "(617) 386-1200",
    "stateAddress": "MA",
    "name": "Cambridge MA -- Kendall Square",
    "longitude": -71.0901,
    "siteGroups": [],
    "sites": [],
    "hours": "9:00am - 5:00pm",
    "links": [
        {
            "rel": "self",
            "href": "https://myserver.example.com:7002/ccadmin/v1/locations"
        }
    ],
    "repositoryId": "Cambridge_MA",
    "country": "USA",
    "county": "Middlesex",
    "email": "store107@example.com",
    "latitude": 42.3629
}

Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices