Description Usage Arguments Details Value Examples
Reports name and Canvas login ID for the current authenticated user, the Canvas domain and the first bit of the token.
1 | cnvs_whoami(.token = NULL, .api_url = NULL, .send_headers = NULL)
|
.token |
Authentication token. Defaults to CANVAS_API_TOKEN environment variable, if set. |
.api_url |
Canvas domain. Used
if |
.send_headers |
Named character vector of header field values
(excepting |
Your canvas domain is the address of your organizations' canvas site, e.g.
https://oregonstate.instructure.com/
, provide this to .api_url
.
Get a personal access token for your Canvas domain from
{CANVAS_DOMAIN/profile/settings}
. The token itself is a string of 66
letters and digits. You can store it any way you like and provide explicitly
via the .token
argument to cnvs()
.
However, many prefer to define an environments variable CANVAS_API_TOKEN
,
and CANVAS_DOMAIN
, with these values in their .Renviron
file. Add
lines that looks like these, substituting your domain and token:
1 2 | CANVAS_DOMAIN="https://canvas.instructure.com"
CANVAS_API_TOKEN= "mvvGbKyGK9n5T57qhEu8K1sNMt85OLoNGTepqd3v5NEcWMuxArSz5aaXppPjodr5eU"
|
Put a line break at the end! If you’re using an editor that shows line
numbers, there should be (at least) three lines, where the third one is empty.
Restart R for this to take effect. Call cmvs_whoami()
to confirm
success.
To get complete information on the authenticated user, call
cnvs("/api/v1/user/self")
.
A cnvs_response
object, which is also a list
.
1 2 3 4 5 6 7 8 | ## Not run:
cnvs_whoami()
## explicit token + domain
cnvs_whoami(.token = "mvvGbKyGK9n5T57qhEu8K1sNMt85OLoNGTepqd3v5NEcWMuxArSz5aaXppPjodr5eU",
.api_url = "https://canvas.instructure.com")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.