In this section, you will find:
- API Usage Requirements
- Trying out an API Example
- cURL Output
API Usage Requirements
To use an API, you must pass in a required HTTP Header of ucsb-api-key
to that API Resource URL. Continue on to see how this is used when you call an API.
Trying out an API Example
Let's take a look at how to use the Academic Quarter Calendar API. Click on the APIs link in the top navigation menu, then click on Academic.
Next, click on the Academic Quarter Calendar link to view its documentation.
Academic" />
This API has a couple GET methods. Click on the GET method for /quartercalendar/v1/sessions/current:
Next, click Try it out.
Review the /quartercalendar/v1/sessions/current documentation.
Note that different APIs will have different Query Parameters or even other Path and Header Parameters depending on their unique requirements, but all APIs will require the ucsb-api-key
HTTP Header.
Let's establish our API Key now by clicking on the Authorize button:
Enter ucsb-api-key
as the name and insert your app Consumer Key from your My First App page as the value and then click Authorize.
Let's click on Send this request to perform the network request. If all went well and the id is valid, you should see a response from the UCPath Employee Map API like this:
[
{
"quarter": "20192",
"qyy": "S19",
"name": "SPRING 2019",
"category": "SPRING",
"academicYear": "2018-2019",
"firstDayOfClasses": "2019-04-01T00:00:00",
"lastDayOfClasses": "2019-06-07T00:00:00",
"firstDayOfFinals": "2019-06-08T00:00:00",
"lastDayOfFinals": "2019-06-14T00:00:00",
"firstDayOfQuarter": "2019-04-01T00:00:00",
"lastDayOfSchedule": "2019-06-23T00:00:00",
"pass1Begin": "2019-02-19T09:00:00",
"pass2Begin": "2019-02-28T09:00:00",
"pass3Begin": "2019-03-11T09:00:00",
"feeDeadline": "2019-03-15T00:00:00",
"lastDayToAddUnderGrad": "2019-04-19T00:00:00",
"lastDayToAddGrad": "2019-04-19T00:00:00",
"lastDayThirdWeek": null
}
]
Note: If your API key is invalid or if you've entered it incorrectly, you'll see an error like this:
{
"fault": {
"faultstring": "Invalid ApiKey for given resource",
"detail": {
"errorcode": "oauth.v2.InvalidApiKeyForGivenResource"
}
}
}
cURL Output
For completeness, you can scroll down to the cURL area to view the full HTTP Request sent via cURL:
Congratulations! You have just completed your first API call.