Snap Schedule 365 schedulers can receive access to the Snap Schedule 365 Application Programming Interface (API). All scheduling data can be accessed and modified from a developer’s Internet-enabled application in a similar way that a web browser accesses Snap Schedule 365.

In fact, the exact same protocol, HTTP, is used in the Snap Schedule 365 API. Developers should follow these steps to ensure healthy communication between their application and Snap Schedule 365:

  1. The application must send an initial login request, which must include a company code, user name, and password, to Snap Schedule 365.
  2. The access token returned by Snap Schedule 365 should then be used by every subsequent request made to Snap Schedule 365.
  3. Access tokens will expire if no requests have been made for a certain amount of time.

Each request made to Snap Schedule 365 must specify a resource URL and an action keyword (verb). For example, the following request header requests a list of active employees:

GET /api/v1/employees

Snap Schedule 365 will respond to the above request by sending a JavaScript Object Notation (JSON) object to the application. The application can also send these JSON objects to Snap Schedule 365, such as when creating an employee using the following request header:

POST /api/v1/employees

Utilizing the REST API

The REST (or Representational State Transfer) API is a resource-based programming interface that is based on six constraints:

  1. A uniform interface
  2. Stateless operation
  3. Client-server architecture
  4. Cacheable
  5. Layered system
  6. Code on demand

REST’s resource-based system separates actions from data (or “verbs” from “nouns”) by identifying resources with URLs and calling particular keywords to manipulate the data located at each URL.

REST’s uniform interface combines functionality from HTTP verbs such as “GET” or “POST”, URLs, and HTTP responses to contribute to a simple yet fundamental client-server architecture, where scalability and error-correction exist.

Data that is manipulated across Snap Schedule 365 to a client application is delivered in a Javascript Object Notation (JSON) format and can be cached on a client machine in an implicit (assumed), explicit (specified), or negotiated manner.

The HTTP Lifecycle

The Hypertext Transfer Protocol (HTTP) defines a set of specifications that help construct a client-server lifecycle. A simple, efficient connection can be maintained if both the client and server comply with HTTP specifications.

The first step in any connection begins with the client, who is responsible for initiating a connection with and using the data returned from the server.

Once a connection has been established, the client must send an initial “login” request to the server. The initial request must include your company code, user name, and password.

Submitting Requests

The Snap Schedule 365 API will only work if a client application submits requests to Snap Schedule 365. These requests control what your application receives from your Snap Schedule 365 schedule database.

Each request that is submitted must have a header and a content body. The header includes key/value pairs that help control how Snap Schedule 365 uses the content body, which contains one or more JSON objects.

All request headers must include:

  • An HTTP verb (such as GET or POST)
  • A resource URL
  • An access token (if logged in)

Handling Responses

It is vital to understand how to process information that Snap Schedule 365 returns to your client application. Snap Schedule 365 responds to your requests by providing an HTTP status code and content in the body of each response. The HTTP status code needs to be examined in order to determine if the request was successful.

The following status codes may be returned from Snap Schedule 365 and should be handled appropriately:

HTTP Status Code Description Meaning
200 OK The call was successful.
401 Unauthorized access The access token was invalid or expired.
404 Resource not found The requested data element was not found.
500 Bad Request The provided data was unable to be processed.

If the call was sucessful (e.g. a 200 HTTP status code) then the body of the response will contain a JSON object. An example of a JSON object is shown below.

If the call was not sucessful (e.g. a 400 HTTP status code) then the body of the response may contain additional information related to the error.

JSON Objects

{
"Name": "John Smith",
"Code": "EMP-1",
"IsActive": "True",
"EmployeeSkills": [{
	"ID": "1"
	"Skill": {
		"Description": "Skill #1"
		"ColorValue": "16711680"
		}
	}]
}

Javascript Object Notation (JSON) is a human-readable, easy-to-use data interchange format. JSON uses a key/value pair system to identify object properties and their corresponding data, all encapsulated inside a set of curly brackets. Each key/value pair must be contained within two sets of double quotation marks and separated by a colon.

JSON objects play a crucial role when it comes to making requests to and getting responses from Snap Schedule 365.