Mothra email address and Kerberos ID lookup API - Developer's Guide - DRAFT
Overview
These APIs provide the ability to look up an email address and kerberos ID by employee ID. If you need assistance with this APIs, please email middleware-api@ucdavis.edu.
Audience
This documentation is intended for those wishing to look up email addresses and kerberos IDs 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.ucdavis.edu/api/mothra/EAK/v1.0/111111111?key=JPO3Dkljsd3Skjkdxxo3SJK00 curl -i -H "Accept: application/json" https://iet-ws.ucdavis.edu/api/mothra/EAK/v1.0/jsmith?key=JPO3Dkljsd3Skjkdxxo3SJK00&type=loginid
These commands perform a lookup of an email address and kerberos ID by employee ID (in the first line), or by loginid (in the second line). The response has a Content-Type of text/javascript.
{ "responseDetails":null, "responseStatus":0, "email":"fakeaddress@ms1.ucdavis.edu", "kerberosID":"fakeloginid", "eid":"111111111" }
JSON reference
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 Email and Kerberos Lookup API is:
https://iet-ws.ucdavis.edu/api/mothra/EAK/v1.0
URL arguments
This section describes the arguments that can be used for lookup 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 <INSERT LINK HERE>. |
type | type=loginid | The type argument should either be left off entirely, or set as 'type=loginid', to specify that instead of an employeeid, you're passing in a loginid. |
Response format
Each response follow this general format:
{ "responseDetails" : null | "string", "responseStatus" : 0 | non-zero integer, "email":"string", "kerberosID":"string", "eid":"string" }
Guaranteed response fields
The result set always contains the parameters listed in this section, even if the value is empty.
Property | Description |
---|---|
responseDetails | Either null, or some other double quote-enclosed string containing an error message |
responseStatus | 0 (zero) on success, or a non-zero number on error |
The personal email address corresponding to the employeeid given | |
kerberosID | The personal kerberos ID corresponding to the employeeid given |
eid | The employee ID passed in |
Trouble shooting
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.