• Uploading a file containing store locations, page 113
• Updating a store location, page 116
• Deleting a store location, page 119
• Retrieving store locations, page 120
Creating a store location
You can create a single store location using the Alert API. The store location is displayed in the Store Locator of your Alert mobile app.
To create a store location, use an HTTP POST request to send the details of the location to the Alert Platform. The request includes a URL format and a JSON object, described below.
© 2014 MicroStrategy, Inc. Creating and managing your store locations: Store Location API 109 This procedure is an alternative to manually creating a store location in CMS.
Once you have called the API to create a store location, the new store is added and displayed in the Store Locator feature of your Alert mobile app.
Prerequisite
• Your application must use an existing Alert administration session token, or create a new one. For the request format to obtain a session token, see Obtaining an Alert administration session token, page 105.
Request format for creating a store location The format of the request URL is shown below.
Request type: POST
HTTP Header: Content-Type:application/json
https://api.alert.com/admin/store_id/shop/create?
token=admin_session_token
Where the variables in italics are as follows:
• store_id (required): The Facebook page ID for your Alert CMS store.
• admin_session_token (required): The Alert administration session token.
The request body must include a JSON object containing the details of the store location.
The structure of the store location object is shown below, with required name/value pairs displayed in bold:
{
"shop_id": string,
"name": string,
"address": string, //Required for physical locations
"city": string,
"state": string,
"zip_code": string,
"country": string,
"type": integer,
"hours": [ {
"name": string,
"value": string,
"date": string
The name/value pairs used in the store location object are described in the table below.
If you do not send optional name/value pairs or if the value is null, the name/value pair is not displayed in your Alert app
Name Data type Required / Optional Description
shop_id string Required The ID of the store location, taken from your data warehouse.
name string Required The name of the store location.
address string Required for physical store locations
The street address of the store location.
city string Optional The city of the store location.
state string Optional The state for the store location.
zip_code string Optional The postal code for the store location.
country string Optional The country for the store location.
type integer Required for online stores
The type of store. The permitted values are as follows:
0: Indicates a physical store location.
1: Indicates an online store.
hours array Optional The working hours of the store location, as an array of JSON objects. The objects in the array are described in hours array, page 111
phone_number string Optional The phone number of the store location.
longitude string Optional The longitude store location, used for the Store Locator in the Alert app.
latitude string Optional The latitude of the store location, used for the Store Locator in the Alert app.
email string Optional The email address of the store location.
© 2014 MicroStrategy, Inc. Creating and managing your store locations: Store Location API 111
hours array
The hours array allows you to define the working hours for the store location.
Depending on how you define the array, the working hours may be displayed in one or more columns in the Alert app’s Store Locator feature.
The format of the objects in the hours array is shown below:
{
"name": string,
"value": string,
"date": string }
An example hours array, showing the possible combinations that can be defined for store hours, is shown below.
[ {
"name": "Monday",
"value": "10:00 am-9:00 pm"
}, {
"name": "Monday",
"value": "9:00 am-9:00 pm",
"date": "2012-12-10"
} ]
The following image shows the store hours in the above example, as displayed in the Alert mobile app.
The name/value pairs in the object are described in the table below:
Response format for creating a store location
The response is a JSON object that indicates whether the store was created successfully, and any errors that may have been encountered.
The structure of the JSON response object is shown below:
{
"error": {
"type": string,
"code": integer },
"response": {
"id": integer }
}
The name/value pairs used in the response object are described in the table below.
Name Data type Required / Optional Description
name string Required The day or days for which the hours are defined.
For example, "Weekdays".
In the Alert mobile app, the name is displayed in the left-most column of the store details page.
value string Required The working hours for the day. For example,
"9:00 am to 6:00 pm".
In the Alert mobile app, the value is displayed in the right-most column of the store details page.
date string Optional A specific date, indicating the hours for a particular date, such as a holiday. For example,
"February 4, 2013".
In the Alert mobile app, the date is displayed in the center column of the store details page.
Name Data type Description
error object Contains details of global errors, such as application errors or database errors, that prevented the operation from proceeding.
© 2014 MicroStrategy, Inc. Creating and managing your store locations: Store Location API 113