Skip to content

API Endpoints

Berk Alp Yakici edited this page Jun 11, 2019 · 11 revisions

OpenStax CMS makes use of API Endpoints to allow other OpenStax services to communicate with our content management service. Most of these endpoints are used by our front-end, but all OpenStax services can make use of the following API endpoints.

[GET] /apps/cms/api/v2

Wagtails main API. This endpoint serves Wagtails elements like pages, images, and documents.

[GET] /apps/cms/api/v2/pages

Returns lists of all pages with their url for details and slug.

[GET] /apps/cms/api/v2/pages/<slug>

Returns details for the given page.

[GET] /apps/cms/api/snippets/roles

Returns list of available roles for a user.

[GET] /apps/cms/api/sticky

Returns the text for the sticky note.

[GET] /apps/cms/api/footer

Returns the text for the footer.

[GET] /apps/cms/api/errata/<id>

Returns details for a piece of Errata

[GET] /apps/cms/api/books

Returns a list of books, with their slug and some information needed to render the subjects page.

[POST] /apps/cms/api/mail/send_mail

Sends mail through Amazon SES. We prevent spamming by only having a limited set of subjects that it will accept and go to a particular email address.

[GET] /apps/cms/api/documents

Returns all documents with their Cloudfront url.

[GET] /apps/cms/api/images

Returns all images with their Cloudfront url.

[GET] /apps/cms/api/progress

Allows writing user progress through the instructor process. This takes an account_id and progress (integer representation of the users progress, 1-5). Can be queried using ?account_id=<id> to retrieve progress.

[GET] /apps/cms/api/salesforce/schools & [GET] /api/schools

Returns a list of adoption schools from Salesforce. Results can be filtered on this API by the following fields:

  • name [string]
  • id [int]
  • type [string]
  • physical_country [string]
  • physical_state_province [string]
  • physical_city [string]
  • key_institutional_partner [bool]
  • achieving_the_dream_school [bool]
  • saved_one_million [bool]
  • testimonial [bool]

[GET] /apps/cms/api/flags

Returns the list of all available feature flags.

[GET] /apps/cms/api/flags?flag=<flag-name>

Returns the conditions for the given flag.

The following are convenience endpoints. They all make use of Wagtail API v2 endpoints at /apps/cms/api/v2/pages/[id] with parameters.

[GET] /apps/cms/api/books

Returns a list of books, with their slug and some information needed to render the subjects page. Redirects to /api/v2/pages/?slug=subjects

[GET] /apps/cms/api/books/<book-slug>

Returns details about a book. Redirects to /api/v2/pages/?slug=<book-slug>

[GET] /apps/cms/api/news

Returns the content of the news pages and a list of articles. Redirects to /api/v2/pages/?slug=openstax-news

[GET] /apps/cms/api/news/<news-article-slug>

Returns the content of a news article. Redirects to /api/v2/pages/?slug=<news-article-slug>.

[GET] /apps/cms/api/pages/<slug>

Returns a page based on slug. Redirects to /api/v2/pages/?slug=<slug>

Clone this wiki locally