{"docs":{"name":"OpenStax Exercises API","info":"\n<p>Access to the API must be achieved through an OAuth flow or by having a user that is logged in to the system (with a session, etc).</p>\n\n<p>When communicating with the API, developers must set a header in the HTTP request to specify which version of the API they want to use:</p>\n<table class='std-list-1' style='width: 80%; margin: 15px auto'>\n  <tr>\n    <th>Header Name</th>\n    <th>Value</th>\n    <th>Version Accessed</th>\n  </tr>\n  <tr>\n    <td><code>'Accept'</code></td>\n    <td><code>'application/vnd.exercises.openstax.v1'</code></td>\n    <td>v1</td>\n  </tr>\n</table>\n<p>Many of the API specifications provide a related JSON schema. These schemas are based on the standard defined at <a href=\"http://json-schema.org/\">http://json-schema.org/</a>. A lot of these schemas aren’t overly specific to the actions they are listed under, e.g. they always say that an <code>id</code> is required but that isn’t the case when new data is being posted to a <code>create</code> call.</p>\n","copyright":"Copyright &copy; 2011-2026 Rice University","doc_url":"/api/docs/v1","api_url":"/api","resources":[{"doc_url":"/api/docs/v1/exercises","id":"exercises","api_url":"/api","name":"Exercises","short_description":"A collection of related questions.","full_description":"\n<p>Exercises are collections of related questions about a very specific situation or topic, possibly united by a common background story.</p>\n","version":"v1","formats":null,"metadata":null,"methods":[{"doc_url":"/api/docs/v1/exercises/index","name":"index","apis":[{"api_url":"/api/exercises","http_method":"GET","short_description":"Return a set of Exercises matching query terms","deprecated":null},{"api_url":"/api/exercises/search","http_method":"GET","short_description":"Return a set of Exercises matching query terms","deprecated":null},{"api_url":"/api/exercises/search","http_method":"POST","short_description":"Return a set of Exercises matching query terms","deprecated":null}],"formats":null,"full_description":"\n<p>Accepts a query string along with options and returns a JSON representation of the matching Exercises. Only Exercises visible to the caller will be returned. The schema for the returned JSON result is shown below.</p>\n\n<h2 id=\"196edb01\" class=\"schema\">Schema</h2>\n<pre class='code'>\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"total_count\",\n    \"items\"\n  ],\n  \"properties\": {\n    \"total_count\": {\n      \"type\": \"integer\",\n      \"description\": \"The number of items matching the query; can be more than the number returned if paginating\"\n    },\n    \"items\": {\n      \"type\": \"array\",\n      \"description\": \"The items matching the query or a subset thereof when paginating\",\n      \"items\": {}\n    }\n  },\n  \"additionalProperties\": false\n}\n</pre>","errors":[],"params":[{"name":"q","full_name":"q","description":"\n<p>The search query string, built up as a space-separated collection of search conditions on different fields. Each condition is formatted as “field_name:comma-separated-values”. The resulting list of exercises will match all of the conditions (boolean ‘and’). Each condition will produce a list of exercises where those exercises must match any of the comma-separated-values (boolean ‘or’). The fields_names and their characteristics are given below. When a field is listed as using wildcard matching, it means that any fields that start with a comma-separated-value will be matched.</p>\n\n<ul>\n<li><code>content</code> – Matches the exercise content. (uses wildcard matching)</li>\n\n<li><code>solution</code> – Matches the exercise solution content. (uses wildcard matching)</li>\n\n<li><code>author</code> – Matches authors’ and copyright holders’ first, last, or full names. (uses wildcard matching)</li>\n\n<li><code>number</code> – Matches the exercise number exactly.</li>\n\n<li><code>version</code> – Matches the exercise version exactly.</li>\n\n<li><code>id</code> – Matches the exercise ID or UID exactly.</li>\n</ul>\n\n<p>You can also add search terms without prefixes, separated by spaces. These terms will be searched for in all of the prefix categories. Any matching exercises will be returned. When combined with prefixed search terms, the final results will contain exercises matching any of the non prefixed terms and all of the prefixed terms.</p>\n\n<p>Examples:</p>\n\n<p><code>content:DTFT</code> – returns exercises containing the DTFT word.</p>\n\n<p><code>number:1 version:2</code> – returns exercise 1@2.</p>\n","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[],"deprecated":false},{"name":"order_by","full_name":"order_by","description":"\n<p>A string that indicates how to sort the results of the query. The string is a comma-separated list of fields with an optional sort direction. The sort will be performed in the order the fields are given. The fields can be one of <code>number</code>, <code>uuid</code>, <code>version</code>, <code>title</code>, <code>created_at</code>, <code>updated_at</code>, <code>published_at</code>. Sort directions can either be <code>ASC</code> for an ascending sort, or <code>DESC</code> for a descending sort. If not provided, an ascending sort is assumed. Sort directions should be separated from the fields by a space. (default: <code>number ASC</code>)</p>\n\n<p>Example:</p>\n\n<p><code>number, version DESC</code> – sorts by number ascending, then by version descending</p>\n","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[],"deprecated":false}],"returns":[],"examples":["https://exercises.openstax.org/api/exercises/?q=author:\"bob\" content:\"test\""],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"/api/docs/v1/exercises/create","name":"create","apis":[{"api_url":"/api/exercises","http_method":"POST","short_description":"Creates an Exercise","deprecated":null}],"formats":null,"full_description":"\n<p>Creates an Exercise with the given attributes.</p>\n\n<h2 id=\"09235374\" class=\"schema\">Schema</h2>\n<pre class='code'>\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"questions\"\n  ],\n  \"properties\": {\n    \"images\": {\n      \"type\": \"string\"\n    },\n    \"logic\": {},\n    \"tags\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"nickname\": {\n      \"type\": \"string\"\n    },\n    \"license\": {},\n    \"solutions_are_public\": {\n      \"type\": \"string\"\n    },\n    \"derived_from\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"title\": {\n      \"type\": \"string\"\n    },\n    \"stimulus_html\": {\n      \"type\": \"string\"\n    },\n    \"questions\": {\n      \"type\": \"array\",\n      \"items\": {}\n    }\n  },\n  \"additionalProperties\": false\n}\n</pre>","errors":[],"params":[],"returns":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"/api/docs/v1/exercises/show","name":"show","apis":[{"api_url":"/api/exercises/:uid","http_method":"GET","short_description":"Gets the specified Exercise","deprecated":null}],"formats":null,"full_description":"\n<p>Gets the Exercise that matches the provided UID.</p>\n\n<h2 id=\"bffcc5b8\" class=\"schema\">Schema</h2>\n<pre class='code'>\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"questions\"\n  ],\n  \"properties\": {\n    \"images\": {\n      \"type\": \"string\"\n    },\n    \"logic\": {},\n    \"tags\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"uuid\": {\n      \"type\": \"string\"\n    },\n    \"group_uuid\": {\n      \"type\": \"string\"\n    },\n    \"number\": {\n      \"type\": \"integer\"\n    },\n    \"version\": {\n      \"type\": \"integer\"\n    },\n    \"uid\": {\n      \"type\": \"string\"\n    },\n    \"published_at\": {\n      \"type\": \"string\"\n    },\n    \"nickname\": {\n      \"type\": \"string\"\n    },\n    \"license\": {},\n    \"solutions_are_public\": {\n      \"type\": \"string\"\n    },\n    \"authors\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"copyright_holders\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"delegations\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"derived_from\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"is_vocab\": {\n      \"type\": \"string\"\n    },\n    \"vocab_term_uid\": {\n      \"type\": \"integer\"\n    },\n    \"title\": {\n      \"type\": \"string\"\n    },\n    \"context\": {\n      \"type\": \"string\"\n    },\n    \"stimulus_html\": {\n      \"type\": \"string\"\n    },\n    \"questions\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"versions\": {\n      \"type\": \"array\"\n    }\n  },\n  \"additionalProperties\": false\n}\n</pre>","errors":[],"params":[],"returns":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"/api/docs/v1/exercises/update","name":"update","apis":[{"api_url":"/api/exercises/:uid","http_method":"PUT","short_description":"Updates the specified Exercise","deprecated":null}],"formats":null,"full_description":"\n<p>Updates the Exercise that matches the provided UID with the given attributes.</p>\n\n<h2 id=\"e034c380\" class=\"schema\">Schema</h2>\n<pre class='code'>\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"questions\"\n  ],\n  \"properties\": {\n    \"images\": {\n      \"type\": \"string\"\n    },\n    \"logic\": {},\n    \"tags\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"nickname\": {\n      \"type\": \"string\"\n    },\n    \"license\": {},\n    \"solutions_are_public\": {\n      \"type\": \"string\"\n    },\n    \"derived_from\": {\n      \"type\": \"array\",\n      \"items\": {}\n    },\n    \"title\": {\n      \"type\": \"string\"\n    },\n    \"stimulus_html\": {\n      \"type\": \"string\"\n    },\n    \"questions\": {\n      \"type\": \"array\",\n      \"items\": {}\n    }\n  },\n  \"additionalProperties\": false\n}\n</pre>","errors":[],"params":[],"returns":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"/api/docs/v1/exercises/destroy","name":"destroy","apis":[{"api_url":"/api/exercises/:uid","http_method":"DELETE","short_description":"Deletes the specified Exercise","deprecated":null}],"formats":null,"full_description":"\n<p>Deletes the Exercise that matches the provided UID.</p>\n","errors":[],"params":[],"returns":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true}],"headers":[],"deprecated":false}]}}