These APIs provide an API to look up a listing of mothra majors and a count of those enrolled. If you need assistance with this APIs, please email middleware-api@ucdavis.edu.
Audience
Excerpt
This documentation is intended primarily for Tim Leamy to look up major numbers via the REST with JSON interface. The query used is as follows:
Code Block
select count(*), majorcode from people
where clienttype in ('U', 'R', 'C', 'P')
and clientstatus = 'A'
and majorcode is not null
group by majorcode
order by majorcode
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.
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.
This section describes the arguments that can be used for Major 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>. 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.
In the JSON fragment above, note that the majorCodeList property contains an array. Guaranteed fields The top-level return object always contains the parameters in this section.
Property
Description
responseStatus
0 (zero) on success, or a non-zero integer on error
responseDetails
A string describing an error, if any
majorCodeList
An array of items, as described in the next section
majorCodeList array: guaranteed fields
The majorCodeList array always contains the parameters listed in this section, even if the value is empty.
Property
Description
code
The four letter text string representing the major code in mothra
count
The count of how many people are enrolled in a major
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.