Queue Scheduling Policies

Queue Scheduling Policies

List Queue Scheduling Policies

Action: GET /queues/scheduling_policies

Fetches a collection of queue scheduling policies. The endpoint requires an array of site_ids. The user whose bearer access token is provided in Authorization header must have super_manager privileges on the requested sites.

Request

The endpoint accepts the following filters when requested by the user:

Parameter

Required

Type

Description

site_ids

Yes

Array of strings

A list of site IDs whose queue scheduling policies are requested.

cURL
Untitled
Untitled
cURL
curl --request GET \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
"https://api.salemove.com/queues/scheduling_policies?site_ids\[\]=51138845-3c46-4c21-8bd8-1cf45957f62e"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'GET',
'https://api.salemove.com/queues/scheduling_policies?site_ids[]=51138845-3c46-4c21-8bd8-1cf45957f62e',
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
xhr.send();
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT = 'https://api.salemove.com/queues/scheduling_policies'
token = ARGV[0].strip
headers = {
'Authorization' => "Bearer #{access_token}",
'Content-Type' => 'application/json'
}
options = {
headers: headers,
query: {
site_ids: ['51138845-3c46-4c21-8bd8-1cf45957f62e']
}
}
raw_response = HTTParty.get(
ENDPOINT,
options
)
response = JSON.parse(raw_response.body)
puts response

Generates the output

{
"scheduling_policies": [
{
"id": "dafcae2c-56cb-4cc7-8162-f2d37a96b030",
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
],
"created_at": "2017-02-20T00:00:00Z",
"updated_at": "2017-02-20T00:00:00Z"
},
{
"id": "38d8980f-8248-456a-bc4f-17258874539c",
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Weekend Policy",
"description": "From 10:00 to 14:00 without lunch",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "10:00",
"closes_at": "14:00",
"days_of_week": ["sat", "sun"]
}
],
"created_at": "2017-02-20T00:00:00Z",
"updated_at": "2017-02-20T00:00:00Z"
}
]
}

Output

Field

Type

Description

scheduling_policies

Array

List of Queue Scheduling Policies.

Get a Queue Scheduling Policy

Action: GET /queues/scheduling_policies/{scheduling_policy_id}

Retrieves the properties of the queue scheduling policy with the given ID. The user whose bearer access token is provided in Authorization header must have super_manager role on the site that the queue scheduling policy is defined for.

cURL
Untitled
Untitled
cURL
curl --request GET \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
"https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'GET',
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030',
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
xhr.send();
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT =
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030'
token = ARGV[0].strip
headers = {
'Authorization' => "Bearer #{access_token}",
'Content-Type' => 'application/json'
}
options = {
headers: headers
}
raw_response = HTTParty.get(
ENDPOINT,
options
)
response = JSON.parse(raw_response.body)
puts response

Generates the output

{
"id": "dafcae2c-56cb-4cc7-8162-f2d37a96b030",
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
],
"created_at": "2017-02-20T00:00:00Z",
"updated_at": "2017-02-20T00:00:00Z"
}

Output

See Queue Scheduling Policy Output.

Create a Queue Scheduling Policy

Action: POST /queues/scheduling_policies

Creates a new queue scheduling policy with a set of specified properties (see Queue Scheduling Policy parameters). The user whose bearer access token is provided in Authorization header must have the role super_manager on the site that the queue scheduling policy is defined for.

cURL
Untitled
Untitled
cURL
curl --request POST \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
--data-binary '{
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
]
}' \
"https://api.salemove.com/queues/scheduling_policies"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://api.salemove.com/queues/scheduling_policies', false);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
var data = {
site_id: 'aa1df566-2106-47d2-86e8-58e4cc996012',
name: 'Default Policy',
description: '08-18, with a lunch-break',
timezone: 'America/New_York',
business_hours: [
{
opens_at: '08:00',
closes_at: '12:00',
days_of_week: ['mon', 'tue', 'wed', 'thu', 'fri']
},
{
opens_at: '13:00',
closes_at: '18:00',
days_of_week: ['mon', 'tue', 'wed', 'thu', 'fri']
}
]
};
var query = JSON.stringify(data);
xhr.send(query);
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT = 'https://api.salemove.com/queues/scheduling_policies'
token = ARGV[0].strip
headers = {
'Authorization' => "Bearer #{access_token}",
'Content-Type' => 'application/json'
}
options = {
headers: headers,
query: {
site_id: "aa1df566-2106-47d2-86e8-58e4cc996012",
name: "Default Policy",
description: "08-18, with a lunch-break",
timezone: "America/New_York",
business_hours: [
{
opens_at: "08:00",
closes_at: "12:00",
days_of_week: ["mon", "tue", "wed", "thu", "fri"]
},
{
opens_at: "13:00",
closes_at: "18:00",
days_of_week: ["mon", "tue", "wed", "thu", "fri"]
}
]
}
}
raw_response = HTTParty.post(
ENDPOINT,
options
)
response = JSON.parse(raw_response.body)
puts response

Generates the output

{
"id": "dafcae2c-56cb-4cc7-8162-f2d37a96b030",
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
],
"created_at": "2017-02-20T00:00:00Z",
"updated_at": "2017-02-20T00:00:00Z"
}

Output

See Queue Scheduling Policy Output.

Update a Queue Scheduling Policy

Action: PUT /queues/scheduling_policies/{scheduling_policy_id}

Updates the properties of the queue scheduling policy with the given ID with a set of specified properties (see Queue Scheduling Policy parameters). Note that the site ID of a queue scheduling policy can not be changed. The user whose bearer access token is provided in Authorization header must have the role super_manager on the site that the queue scheduling policy is defined for.

cURL
Untitled
Untitled
cURL
curl --request PUT \
--header "Authorization: Bearer $access_token" \
--header "Content-Type: application/json" \
--data-binary '{
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
]
}' \
"https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'POST',
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030',
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.setRequestHeader('content-type', 'application/json');
var data = {
name: 'Default Policy',
description: '08-18, with a lunch-break',
timezone: 'America/New_York',
business_hours: [
{
opens_at: '08:00',
closes_at: '12:00',
days_of_week: ['mon', 'tue', 'wed', 'thu', 'fri']
},
{
opens_at: '13:00',
closes_at: '18:00',
days_of_week: ['mon', 'tue', 'wed', 'thu', 'fri']
}
]
};
var query = JSON.stringify(data);
xhr.send(query);
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT =
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030'
token = ARGV[0].strip
headers = {
'Authorization' => "Bearer #{access_token}",
'Content-Type' => 'application/json'
}
options = {
headers: headers,
query: {
name: "Default Policy",
description: "08-18, with a lunch-break",
timezone: "America/New_York",
business_hours: [
{
opens_at: "08:00",
closes_at: "12:00",
days_of_week: ["mon", "tue", "wed", "thu", "fri"]
},
{
opens_at: "13:00",
closes_at: "18:00",
days_of_week: ["mon", "tue", "wed", "thu", "fri"]
}
]
}
}
raw_response = HTTParty.put(
ENDPOINT,
options
)
response = JSON.parse(raw_response.body)
puts response

Generates the output

{
"id": "dafcae2c-56cb-4cc7-8162-f2d37a96b030",
"site_id": "aa1df566-2106-47d2-86e8-58e4cc996012",
"name": "Default Policy",
"description": "08-18, with a lunch-break",
"timezone": "America/New_York",
"business_hours": [
{
"opens_at": "08:00",
"closes_at": "12:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
},
{
"opens_at": "13:00",
"closes_at": "18:00",
"days_of_week": ["mon", "tue", "wed", "thu", "fri"]
}
],
"created_at": "2017-02-20T00:00:00Z",
"updated_at": "2017-02-20T00:00:00Z"
}

Output

See Queue Scheduling Policy Output.

Delete a Queue Scheduling Policy

Action: DELETE /queues/scheduling_policies/{scheduling_policy_id}

Removes a queue scheduling policy with the given ID if there are no queues using this scheduling policy. The user whose bearer access token is provided in Authorization header must have the role super_manager on the site that the queue scheduling policy is defined for.

cURL
Untitled
Untitled
cURL
curl --request DELETE \
--header "Authorization: Bearer $access_token" \
"https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030"
Untitled
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var xhr = new XMLHttpRequest();
xhr.open(
'DELETE',
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030',
false
);
xhr.setRequestHeader('authorization', `Bearer ${accessToken}`);
xhr.send();
var response = JSON.parse(xhr.responseText);
console.log(response);
Untitled
require 'httparty'
ENDPOINT =
'https://api.salemove.com/queues/scheduling_policies/dafcae2c-56cb-4cc7-8162-f2d37a96b030'
token = ARGV[0].strip
headers = {
'Authorization' => "Bearer #{access_token}"
}
options = {
headers: headers
}
raw_response = HTTParty.delete(
ENDPOINT,
options
)
response = JSON.parse(raw_response.body)
puts response

Generates the output

204 No Content

Queue Scheduling Policy Parameters

Parameter

Type

Required

Description

site_id

String

Yes

ID of the site to create a queue scheduling policy on. Can not be modified.

name

String

Yes

Queue scheduling policy name.

description

String

No

Queue scheduling policy description.

timezone

String

Yes

The timezone of queue scheduling policy business hours. Must be a valid timezone name in Olson format. Example: America/New_York.

business_hours

Array of Business Hours

Yes

A collection of rules determining the days of week and daily time intervals during which all the queues with the current scheduling policy must be opened.

Queue Scheduling Policy Output

Parameter

Type

Description

site_id

String

ID of the site to create a queue scheduling policy on.

name

String

Queue scheduling policy name.

description

String

Queue scheduling policy description.

timezone

String

The timezone name of queue scheduling policy business hours in Olson format. Example: America/New_York.

business_hours

Array of Business Hours

A collection of rules determining the days of week and daily time intervals during which all the queues with the current scheduling policy must be opened. Example: ["mon", "tue", "wed"].

created_at

String

An ISO-8601 timestamp of when the queue scheduling policy was created.

updated_at

String

An ISO-8601 timestamp of when the queue scheduling policy was last updated.

Business Hours Object

Parameter

Type

Required

Description

opens_at

String

Yes

Start of the interval, must be in format of HH:MM, where HH is an hour of the day, 24-hour clock (00..24), and MM is a minute of the hour (00..59). The interval is closed-open (inclusive lower bound, exclusive upper bound). Examples: 09:05, 15:30

closes_at

String

Yes

End of the interval, must be in the same format as the start of the interval (see parameter opens_at).

days_of_week

Array of String

Yes

A list of weekdays which current rule applies to. Weekdays must be in format of 3-letter weekday case-insensitive abbreviations (mon, tue, wed, thu, fri, sat, sun). The list must contain at least 1 element, duplicates are ignored.