University of Southern California

ITS Web Services


Schedule of Classes API


Top

SOC service

api.php is a restful interface to the Schedule of Classes data. It caches content retrieved from REG/SIS’s SOAP service and presents it in a format suitable for inclusion in a CMS deployed schedule of classes site. Most resources can be retrieved in JSON formatted output.

JSON content can be easily turning to an associative array with the PHP 5 call to json_decode. e.g.

$myhash = json_decode($json_string,true);

If you are in the browser you can do a simple JavaScript eval to turn the JSON content you retrieved with an xmlhttprequest object into a JavaScript associative array. e.g.

eval("myhash = " + json_string + ";");

To acccess the JSON content you need to use the fetch the document via http. The URI is formulated in a REST style. api/[service]/[options].

Examples

The cache

This API is driven by pulling the general data from the Registrar’s office data and populating a cache of the data appropriately. This process is managed through our RESTful API. You can see the contents of the current cache by pointing your browser at http://web-app.usc.edu/ws/soc/api/cache. Periodically you may want to remove/expire contents in the cache go to http://web-app.usc.edu/ws/soc/manage. This isn’t something you usually need to do though as it is run automatically form a cron job.