Making Your First Sierra API Call
In the previous tutorial, we used the Sierra API Client Credentials Grant to authenticate with a Sierra server. We can now use the bearer token (also referred to as the access token) that we created to make an API call.
Our goal in this tutorial is to obtain a list of new titles that we can use to populate a library web site that promotes recent acquisitions.
If necessary, download and install the Advanced REST Client Chrome plug-in or a similar REST client.
The access token from the previous post probably has expired. As a security measure, Sierra assigns them a lifespan of 3,600 seconds (60 minutes). To make our first Sierra API call, we must repeat the previous tutorial and obtain a new token.
- Obtain a new token. If needed, follow the procedure in the previous tutorial. The access token is located in the return, as shown in the following image.
Next, we must construct an API call that returns all of the bibs created after a certain date. The sample data on the sandbox server does not included any recently created bibs. For this tutorial, we need to use an earlier date than we might apply to an actively growing library catalog. We’ll create an API call that retrieves the title, author, and year of publication for all the bibs in the sandbox library that are not deleted, not suppressed, and were created on or after July 30, 2013 at 7:20PM and 28 seconds.
- Set the Method to GET.
- Set the Request URL located next to the GET method to:
- Add the following query parameters under Headers. To add a parameter, click the plus sign beside ADD HEADER. A new row appears with Header Name and Parameter Value settings. Enter the parameter name under Header name and the value under Parameter value.
- deleted = false
- suppressed = false
- createdDate = [2013-07-30T19:20:28Z,]
- fields = title,author,publishYear
- Add another header and enter your bearer token. Enter Authorization under the Header name and Bearer <access token> under Parameter value.
The defined list of parameters appears as follows:
- Click the Send button located to the right of the Request URL field.
The API returns a status of 200 and a JSON-formatted list of bib records matching the query parameters, as shown below. You may need to scroll down to view the return.
We have authenticated with the Sierra API on the Innovative Sandbox server and made our first successful API call. You can extend this example to the other API endpoints to access and update patron profile information, holds, fines, items, and authority records.