OverviewThese APIs provide a lookup API for Banner PIDMs provided by mothra. If you need assistance with this APIs, please email middleware-api@ucdavis.edu. Audience Excerpt |
---|
This documentation is intended for developers who wish to look up Banner PIDMs 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 requirementsEach 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 interfaceThe 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. Code Block |
---|
| curl -i -H "Accept: application/json" https://iet-ws-test.ucdavis.edu/api/mothra/PIDMByLoginid/v1.0/lizardo?key=JPO3Dkljsd3Skjkdxxo3SJK00 |
This command looks up a Banner PIDM based on <loginid>, which for example could be 'lizardo', 'dave', etc. The response has a Content-Type of text/javascript. Code Block |
---|
lang | xml |
---|
title | Sample JSON Response |
---|
lang | xml |
---|
|
{"pidm":"176930","loginid":"lizardo","responseDetails":null,"responseStatus":0}
|
JSON referenceUnlike 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.
URL base address The standard URL for the IET Middleware Banner PIDM lookup API is: https://iet-ws.ucdavis.edu/api/mothra/PIDMByLoginid/v1.0/ URL argumentsThis section describes the arguments that can be used for PIDM lookups. 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 argumentsThe 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 <INSERT LINK HERE>. It must be a valid key associated with your application. The key is required for this API to implement quality of service rules for this API. If your application is making too many requests it will be throttled to ensure resources are not overloaded during times of peak usage. Also, by supplying a key we can identify and contact you should something go wrong with your application. |
Path variablesThe URL's path itself contains information pertaining to the loginid to look up, as well as the API version. First, the string "v1.0" may change over time to address newer versions. Secondly, the last portion of the path is the loginid for which to retrieve a PIDM. For example, to look up the loginid 'lizardo', your query URL would look like: Code Block |
---|
|
https://iet-ws.ucdavis.edu/api/mothra/PIDMByLoginid/v1.0/lizardo?key=JPO3Dkljsd3Skjkdxxo3SJK00
|
Each response follow this general format: Code Block |
---|
|
{
"responseDetails" : null | "string-on-error",
"responseStatus" : integer,
"PIDM" : "string",
"loginid" : "string"
}
|
Results array: guaranteed fieldsThe results array always contains the parameters listed in this section, even if the value is empty. Property | Description |
---|
loginid | The loginid passed in as part of the URL path | PIDM | The Banner PIDM, or null if no PIDM exists | responseStatus | The status of the PIDM lookup. It will be 0 (zero) on success, or a non-zero number on error | responseDetails | A string describing any errors that may have occurred. |
Troubleshooting If you encounter problems with your code: - Make sure your API key is valid.
- Look for typos. Remember that JavaScript is a case-sensitive language.
- Use a JavaScript debugger. In Firefox, you can use the JavaScript console or the Firebug. In IE, you can use the Microsoft Script Debugger.
- If you need to examine the JSON string returned from the server, you can use JSON Lint to make a single, long string human readable.
- Email middleware-api@ucdavis.edu with a description of your problem and a trace of the request and response.
|