Faculty Database Web Service API Documentation Overview

advertisement
Faculty Database Web Service API Documentation
Michael Rothfuss – 04/22/14
Overview
The Faculty Database provides a web service which allows third party programs or websites to
connect and access data provided.
The newest version of this document can be found here:
http://cas.umt.edu/facultydatabase/2013_API/Documentation.doc
Guided Connection
The first step in connecting to the web service is to build a list of arguments to query the database
with. As these arguments are all identification numbers, we have built a tool to help you generate
your list of arguments. The tool will ask you to select items from lists of schools, departments,
faculty types, and faculty tags. If no schools are selected, for example, then all schools will be
queried. The tool will then provide two URLs, one for JSON data and another for XML data. The
third party program may then download the data by using the chosen URL.
Tool URL: http://cas.umt.edu/facultydatabase/2013_API/helper.php
Advanced Connection: URL Options and Arguments
The options offered by this API are 'school', 'department', 'type', 'tag', and 'id'. Each one of these
options takes a comma separated list of integers as its argument.
There are four other options, 'XML', 'JSON', 'EXTEND', and 'INCTAG'. XML and JSON specify
what format the data will be transported in. These options have no arguments. EXTEND and
INCTAG are options for the JSON format that alters output format, see Data Output for more
information.
API Base Path: http://cas.umt.edu/facultydatabase/2013_API/server.php
Example Options & Arguments: /school/15,17/JSON
Example URL: http://cas.umt.edu/facultydatabase/2013_API/server.php/school/15,17/JSON
Data Output
The API returns the following items per matched faculty: ID, FirstName, LastName, Photo, Title,
PersonalURL, CVURL, Email, OfficeLocation, Phone, Fax, OfficeHours, CurrentPosition, Courses,
Affiliations, Education, Honors, FieldOfStudy, TeachingExperience, ProfessionalExperience,
InternationalExperience, SpecializedSkills, publications, SelectedPublications, Projects,
ResearchInterests, Summery, and Hobbies. The output is ordered by LastName then FirstName.
Custom Fields have variable output. In XML mode, custom fields are sent in the same method as
regular fields – but with spaces replaced with underscores (_). In JSON EXTEND mode, these fields
are stored in an array called 'customFields', with the keys 'fieldName' and 'fieldValue' set. When
the INCTAG option is activated in JSON mode, an array of applied Tag IDs are appended to the end
of the data set under the name 'Tags'.
PHP Example Connection with JSON
In this example, we will display a list of last names of the faculty in the 'Spectral Fusion Designs'
department with the applied tag 'Programmer'.
Code Example
$raw =
file_get_contents('http://cas.umt.edu/facultydatabase/2013_API/server.php/school/19/department/1/tag/72/JSON');
$data = json_decode($raw);
foreach($data as $person){
echo $person->LastName.'<br>';
}
Download