a0559a10ea
CLOSES: DOC-1038 Test plan: - Jenkins passes - Links work correctly for changelog 2019-04-20 entry Change-Id: Ia3a211c53270efa961cce034f665c21c10ce14c3 Reviewed-on: https://gerrit.instructure.com/188279 Tested-by: Jenkins Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com> Product-Review: Rob Orton <rob@instructure.com> |
||
---|---|---|
.. | ||
appendix/html | ||
docstring/html | ||
fulldoc/html | ||
layout/html | ||
method_details/html | ||
tags | ||
topic/html | ||
README.md | ||
api_routes.rb | ||
assignment_external_tools.md | ||
assignment_tools.md | ||
breaking.md | ||
caliper_live_events.md | ||
changelog.md | ||
changelog_archive.md | ||
compound_documents.md | ||
content_item.md | ||
developer_keys.md | ||
editor_button_tools.md | ||
endpoint_attributes.md | ||
file_uploads.md | ||
homework_submission_tools.md | ||
jwt_access_tokens.md | ||
link_selection_tools.md | ||
live_events.md | ||
masquerading.md | ||
navigation_tools.md | ||
oauth.md | ||
oauth_endpoints.md | ||
object_ids.md | ||
originality_report_appendix.md | ||
outcomes_csv.md | ||
pagination.md | ||
plagiarism_platform.md | ||
sis_csv.md | ||
subscriptions_appendix.md | ||
throttling.md | ||
tools_intro.md | ||
tools_variable_substitutions.head.md | ||
tools_variable_substitutions.md | ||
tools_xml.md | ||
xapi.md |
README.md
Welcome to the Canvas LMS API Documentation
Canvas LMS includes a REST API for accessing and modifying data externally from the main application, in your own programs and scripts. This documentation describes the resources that make up the API.
To get started, you'll want to review the general basics, including the information below and the page on Authentication using OAuth2.
API Changes
To follow notable API changes, view the API Change Log.
For a summary of all deprecations, view the breaking changes API page.
API Terms of Service
Please carefully review The Canvas Cloud API Terms of Service before using the API.
Schema
All API access is over HTTPS, against your normal Canvas domain.
All API responses are in JSON format.
All integer ids in Canvas are 64 bit integers. String ids are also used in Canvas.
To force all ids to strings add the request header Accept: application/json+canvas-string-ids
This will cause Canvas to return even integer IDs as strings, preventing problems with languages (particularly JavaScript) that can't properly process large integers.
All boolean parameters can be passed as true/false, t/f, yes/no, y/n, on/off, or 1/0. When using JSON format, a literal true/false is preferred, rather than as a string.
For POST and PUT requests, parameters are sent using standard HTML form encoding (the application/x-www-form-urlencoded content type).
POST and PUT requests may also optionally be sent in JSON format format. The content-type of the request must be set to application/json in this case. There is currently no way to upload a file as part of a JSON POST, the multipart form type must be used.
As an example, this HTML form request:
name=test+name&file_ids[]=1&file_ids[]=2&sub[name]=foo&sub[message]=bar&flag=y
would translate into this JSON request:
{ "name": "test name", "file_ids": [1,2], "sub": { "name": "foo", "message": "bar" }, "flag": true }
With either encoding, all timestamps are sent and returned in ISO 8601 format (UTC time zone):
YYYY-MM-DDTHH:MM:SSZ
Authentication
API authentication is done with OAuth2. If possible, using the HTTP Authorization header is recommended. Sending the access token in the query string or POST parameters is also supported.
OAuth2 Token sent in header:
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://canvas.instructure.com/api/v1/courses"
OAuth2 Token sent in query string:
curl "https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>"
Read more about OAuth2 and how to get access tokens.
SSL
Note that if you make an API call using HTTP instead of HTTPS, you will be redirected to HTTPS. However, at that point, the credentials have already been sent in clear over the internet. Please make sure that you are using HTTPS.
About this Documentation
This documentation is generated directly from the Canvas LMS code. You can generate this documentation yourself if you've set up a local Canvas environment following the instructions on Github. Run the following command from your Canvas directory:
bundle exec rake doc:api