I want to obtain data through canvas API from a moodle course that our institute is doing right now. I went through the documentation and I have generated an access token as advised in the API documentation. But now I don't know how to proceed.
I tried different examples in the chrome browser console.
ex: GET https:///login/oauth2/auth? client_id=XXX&response_type=code&redirect_uri=https://example.com/oauth_complete&state=YYY
But it didn't provide me any result. Instead I got errors such as "Uncaught SyntaxError: Unexpected identifier".
Can someone please tell me where should I start?
Thanks a lot.
You can generate an Access Token by going to "Account -> Settings -> New Access Token" Then copy down the access token.
Then you can make api calls by either
Attaching that access token to your request as a header curl -H "Authorization: Bearer <token>" 'http://<canvas>/api/v1/accounts/<account_id>/courses
or
Attaching the access token as a GET query parameter
http://<canvas>/api/v1/accounts/<account_id>/courses?access_token=token_of_magical_powers
Beware that the access token has all of the same privileges as the user for whom it was generated, so keep it guarded.
More documentation and examples can be found in the canvas community pages.