DRAFT * DRAFT * DRAFT
This documentation is a work in progress and should not be use for production applications.
Overview
These APIs provide a bulk load API for data that is published from the Online Directory system. If you need assistance with this APIs, please email middleware-api@ucdavis.edu.
Audience
This documentation is intended for developers who wish to perform a bulk download of the public data within the Online Directory system from within their application via the REST with JSON interface.
This is currently the only interface available for this API. If you would like to see an XML interface please email middleware-api@ucdavis.edu.
Application requirements
Each request must provide a valid application key. You may sign up for your own application key here <INSERT LINK>.
During periods of peak usage, API requests may be throttled.
Using the JSON interface
The easiest way to start learning about this interface is to try it out. This section shows how to use the curl command line tool to execute sample queries.
curl -i -H "Accept: application/json" https://iet-ws-test/directory/load?key=JPO3Dkljsd3Skjkdxxo3SJK00&v=1.0
This command performs a bulk load request (/directory/load). The response has a Content-Type of text/javascript.
{ "responseData" : { "results" : [ {"firstName":"Curtis","lastName":"Bray","phone":"754-6199","deptNum":12345} ], "cursor" : { "estimatedResultCount": "20102", "currentIndex": 0, "moreResultsUrl": "https://iet-ws-test/ondir/load?start=500" } }, "responseDetails" : null, "responseStatus" : 200 }
JSON reference
Unlike the core JavaScript interface, the JSON interface is exposed through a uniform URL that contains CGI arguments. Your application can use an HTTP stack of its choosing. In order to use the JSON interface:
- You must construct a properly formatted URL with all necessary CGI arguments.
- You must send an HTTP referer header that accurately identifies your application.
- You must process the JSON-encoded response.
Request format
URL base address
The standard URL for the IET Middleware Online Directory Bulk Load API is:
https://iet-ws.ucdavis.edu/directory/load
URL arguments
This section describes the arguments that can be used for Bulk Load requests.
The value of a CGI argument must always be properly escaped. This can be done via the functional equivalent of JavaScript's encodeURIComponent() method.
Required URL arguments
The following table lists the required URL arguments.
Argument |
Example |
Description |
---|---|---|
key |
key=your-key |
This argument supplies the application's key. You can sign up for an API key on the sign-up page. |
v |
v=1.0 |
This argument supplies protocol version number. The only valid value at this point in time is 1.0. |
Optional URL arguments
The following table lists the optional URL arguments.
Argument |
Example |
Description |
---|---|---|
start |
start=500 |
This argument supplies the starting record index of the first search result. Each successful response contains a cursorobject (see below) which includes an array of pages. The start property for a page may be used as a valid value for this argument. For reference, a sample cursor object is shown below: "cursor" : Unknown macro: { "estimatedResultCount"}
|
userip |
userip=192.168.0.1 |
This argument supplies the IP address of the end-user on whose behalf the request is being made. Requests that include it are less likely to be mistaken for abuse. In choosing to utilize this parameter, please be sure that you're in compliance with any local laws, including any laws relating to disclosure of personal information being sent. |
Response format
Each response follow this general format:
{ "responseData" : { "results" : [], "cursor" : {} }, "responseDetails" : null | string-on-error, "responseStatus" : 200 | error-code }