Skip to content

ABE API

Oliver Steele edited this page May 21, 2018 · 10 revisions

Testing the APIs

The ABE API documentation is here. This documentation describes ABE's REST (HTTP) endpoints. Click on a resource row ("events", "labels", etc.) to see its methods; click on a method to see its description. Click on “Models” to see documentation for each of the models.

The documentation page contains interactive documentation created via Swagger. You can “Try it out”, to perform an operation from within the web page.

Most of the APIs (the ones with locks) require that you sign in to use them. Click the “Authorize” button at the top of the page to sign in. Some APIs (creating, modifying, and deleting Labels; anything to do with Apps) require that you sign in as a administrator. Currently, you can only sign in as an administrator by signing in with email, and only if your email address is on a whitelist. TODO: make it possible for anyone inside the intranet to sign into the dev server as an admin.

Postman is a desktop application for testing APIs. https://abe-api.olin.build/docs/postman.json specifies ABE's API as a Postman collection. Use this with Postman's Import > “Import from Link”.

Using the APIs

Most API calls (the ones with locks) require authentication. See the documentation on User Authentication.

Exceptions are:

  • /user, which tells whether the current user is signed in, and whether the user agent is inside the intranet.
  • /events, which retrieves a list of public events when the user is not signed in. (When the user is signed in, it retrieves a list of all events, within the specified time period. Look at /user to tell which it's doing.)

OAuth Flow

The API server also supplies an /oauth/authorize endpoint, for initiating the OAuth 2.0 Implicit Grant flow. Use this to sign a user in. You can use this to retrieve an authentication token to use with ABE's restricted APIs, or so that your application can grant access to Olin community members who are outside the intranet. See User Authentication.

Clone this wiki locally