SimpleVoIP provides a REST-like API to allow customers to enqueue bulk jobs to modify their store Time of Day rules (the rules governing store open vs. closed logic).
Prerequisites
Your stores must have been provisioned with Time of Day-dependent routing. If your stores handle all calls the same way 24/7, this API will not have any effect on your call routing. Contact your account manager to confirm that your stores are provisioned with Time of Day support.
You will also need an API key provided by the SimpleVoIP Engineering team. These are available upon request. Please reach out to your account manager to initiate this process.
API Description
All update requests are made via a PUT request to https://public.simplevoip.us/tod_rules and should contain a JSON-encoded body as defined below.
On successful request, a set of jobs are enqueued (one job per affected store) that will be executed over the course of the next few minutes. We expect a batch job to execute on the order of 20 sites per minute. Changes to site behavior will occur immediately as the individual site jobs are executed.
Authentication
The API is secured by Bearer token authentication. You should supply the following header on your PUT request, using the API key provided by SimpleVoIP as the {token_string} value:
Authorization: Bearer {token_string}
Request Body Definition
The request body must be a JSON object containing the following 2 properties:
sites
(type: array
): A list of store numbers (type: string
) to which the selected changes should be applied. The supplied rule changes will be applied uniformly to all sites. These store numbers must match the store numbers used by SimpleVoIP to refer to your stores, which may not necessarily match your internal labeling scheme. Please confirm the store numbers we have on file for you with your account manager.
rules
(type: array
): A list of Rule Objects (see below). This list only needs to contain the rules being changed. For example, if you are not changing your Monday store hours for the stores given in `sites`, you should not include the Monday rule in this list.
Rule Objects
A rule object contains the following properties:
name
(type: string
): The name of a Time of Day rule to update. This must match a provisioned Time of Day rule name on your account. Your account manager should provide you the names of the TOD rules provisioned at your stores.
time_window_start
(type: int
): The time the store should be considered "open", in seconds past midnight (e.g. 32400 secs = 3600 * 9 => 9am)
time_window_stop
(type: int
): Closing time for this rule, in seconds past midnight (e.g. 61200 => 17:00)
enabled
(type: bool
): [Optional] Overrides the time of day-based setting to force a store open or closed for the entire day to which the rule applies. This property can have one of 3 values:
null
: [default] Standard mode. Store is considered "open" between thetime_window_start
andtime_window_stop
rule times, and closed outside that time range.true
: 24-Hour mode. The store is considered "open" for the entire day regardless ofstart/stop
rule times.false
: Forced Closed mode. The store is considered "closed" for the entire day, regardless ofstart/stop
rule times.
enabled
property of the Sunday rule to false
. You would then have to set enabled: null
to re-open those stores on Sundays.Example:
For this example, we will assume a customer is provisioned with the following rule names:
MainSunday
MainMonday
MainTuesday
MainWednesday
MainThursday
MainFriday
MainSaturday
We will also assume that the customer's store names follow the format 1001, 1002, 1003, etc.
Request:
The following example request would update the Tuesday and Wednesday open hours at sites 1001 and 1003:
curl -X PUT https://public.simplevoip.us/tod_rules \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {token_string}'
Response:
FAQs
Do we need to provide all rule settings in a request?
No - as a matter of fact, you should only provide the rules that need to be updated in each request.
What if we need to change hours at multiple stores, but the hours at each store are different?
Unfortunately, we only support 1 rules
block right now. You will need to break this up into multiple requests as all of the sites
in each individual request will receive the same updates.
Which time zone are the start and stop times in?
All times are considered local to the site. You can set a NYC store and a Honolulu store to the same time_window_start
of 32400 and each will open at 9am local time.