Home /

Union API Documentation

     8:16 am in Troy      Wednesday, Nov 22

The Union API allows for simple, automated access to student information. You can use the API to enable your club's web site or web application to automatically gather student information, freeing visitors to your web site or users of your web application from needlessly having to enter their own information.

If you have an issue using the API or you would like to suggest a new feature for the API, contact the Union Systems Administrators.

General Queries

You can use the API using either a GET or POST request. The API is being developed for use with AJAX requests from Club Websites. For security purposes, you will only be able to query the API from web sites that are hosted by the Rensselaer Union. Queries from any other web server will be denied access.

A normal query URL looks like this:
http://api.union.rpi.edu/query.php?task=API_TASK&param1=value1&param2=value2&apikey=YOUR_API_KEY_HERE

You should replace YOUR_API_KEY_HERE with the API Key provided to your club in the Web Access Password section of your club's page in the CMS.

API Tasks

Replace API_TASK in the above URL with one of the following API Tasks:

  • GetUser - Get User Information (RCSID and Name)

    You can query by someone's RCSID or by their RIN.
    You can include the user's middle name by using the &middlename option somewhere in the Query URL.

    • by RCSID
      Example: http://api.union.rpi.edu/query.php?task=GetUser&rcsid=doej8&middlename&apikey=YOUR_API_KEY_HERE
    • by RIN
      Example: http://api.union.rpi.edu/query.php?task=GetUser&rin=123456789&apikey=YOUR_API_KEY_HERE
    • by ID (does not support middle name)
      Example: http://api.union.rpi.edu/query.php?task=GetUser&dbid=10&apikey=YOUR_API_KEY_HERE
  • ListAllOrganizations - List all Clubs and Organizations by ID
    Example: http://api.union.rpi.edu/query.php?task=ListAllOrganizations&apikey=YOUR_API_KEY_HERE
  • GetOrganization - Get information about a Club or Organization
    Example: http://api.union.rpi.edu/query.php?task=GetOrganization&id=CLUB_ID_HERE&apikey=YOUR_API_KEY_HERE
  • GetUserOrgs - Get the club IDs of the clubs in which the user is an officer.
    Example: http://api.union.rpi.edu/query.php?task=GetUserOrgs&rin=A_RIN&apikey=YOUR_API_KEY_HERE

Output

All API Queries produce JSON Output. At the top level of the produced JSON Object, you will find two subobjects: one named result, which contains the result data for the query performed, and one named status, which shows status information about a Query, including any errors, if any occurred.

Errors

The output JSON object should always provide an error code and description for where your query went wrong. We use certain error codes that you can check against to see what the issue was:

  • Error Code 0

    Everything seemed to go according to plan!

  • Error Code 2

    You either did not provide a Task option or the Task option you provided did not correspond to a valid API Task. The valid API Tasks are listed above.

  • Error Code 3

    There was a database error while processing your request. If the error does not help you figure out what went wrong, please contact the Systems Administrators for assistance.

  • Error Code 4

    The API Key you provided was invalid. We use the API Key system to ensure that the data accessible using the API is being used for legitimate purposes.

  • Error Code 5

    You tried to access the API from an unauthorized computer. We make sure that only our club web sites are able to access the Union API.

  • Error Code 10

    The data that you provided did not pass basic validation tests; for example, an e-mail address is always of the format <a>@<b>.<c>. We check every data input for validity before looking up data based on the query; it doesn't make sense to waste our database server's time searching for records that we can see are invalid.

  • Error Code 11

    The data that you provided did not match any of our records. This could mean that you have a data input that looks valid but doesn't match any records we have.

User Login

To take full advantage of our club management features, please log in below.

If you have an RCS ID, please log in here.

Otherwise, please log in here.