Skip to content

API Endpoints

Ed Woodward edited this page Jul 19, 2022 · 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.

[GET] /apps/cms/api/donations/donation-popup/

Returns data for donation popup. Includes flag to hide the popup

[POST] /apps/cms/api/donations/thankyounote/

Creates thank you note entry. Example payload (user information can be blank): {"thank_you_note":"OpenStax is the best! Loved not paying for a book","first_name": "Jessica","last_name": "Drew", "institution": "Rice University", "created": "2021-10-21", "consent_to_share_or_contact": "True","contact_email_address": "jess@example.com"}

[GET] apps/cms/api/donations/fundraiser/

Returns data for fundraiser. Sample Json

[
  {
    "color_scheme":"red",
    "message_type":"message",
    "headline":"Pay it <span class=\"color\">forward.</span>",
    "message":"Messaging that talks about how OpenStax free resources help students graduate, and how OpenStax relies on charitable contributions.",
    "button_text":"Give today",
    "button_url":"/give",
    "box_headline":"Lorem ipsum dolor sit amet lorem ipsum dolor lorem sit amet.",
    "box_html":"Even donations of just <b>$1, $5, or $10</b> can lorem ipsum dolor sit amet.",
    "fundraiser_image":"http://localhost:8000/media/sample-blue-200x200.jpg",
    "goal_amount":1234,
    "goal_time":"2022-01-12T09:07:01-06:00"
  }
]

[GET] /apps/cms/api/salesforce/partners/

Returns list of all partners

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

Returns Give Banner Json

[GET] /apps/cms/api/give-today

Returns Give Today Json

[GET] /apps/cms/api/webinars

Returns list of Webinars

[GET] /apps/cms/api/webinars/?subject=Math

Returns list of Webinars filtered by Subject

[GET] /apps/cms/api/snippets/<snippet name>

Returns list of snippets by name

[GET] /apps/cms/api/v2/pages/form-headings

Returns form headings for adoption and interest forms


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>