Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
How do I make a curl request to start an account report? specifically grade export. I have tried all kinds of things but nothing will start the report. here is my last thing I tried. I thought by the documentation when it says
my curl request should be this:
curl -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "https://emmanuelcollege.instructure.com/api/v1/accounts/1/reports/grade_export_csv"
All I get is a bunch of json data back but the report is not showing up inside Canvas as running. I don't completely understand how this all works and I read other post about starting a report but I haven't seen exactly how to do it with curl.
Glenn Toney
Emmanuel College
Director of IT
Its a POST, so you need to tell curl that. For example:
curl -k $server/api/v1/accounts/$account_id/reports/grade_export_csv \
-X POST \
-H "Authorization: Bearer $token"
and you will get back something like:
{"id":51,"progress":0,"parameters":null,"current_line":null,"status":"running","report":"grade_export_csv","file_url":null}
Thanks you so much. I understand now why it wasn't starting the report. My next question is downloading that file. When I issue a curl command to try to download the file I get a redirect to the login page. We have Active Directory authentication to our school and even though I pass a authorization bearer it still goes to the login page. I have tried to add a --location ../login/canvas to the curl command and pass my credentials to the login page but have yet to get it to work doing that. Is there a way to bypass the authorization page and just get the csv file. We are trying to script this to automatically get the grade report every day and import it into our sis. Any recommendation would be helpful.
Well I finally figured out that you did not need the authorization bearer on the URL that downloaded the file. Also had to add the --location to follow redirects.
My curl script looks like this now.
curl "https://<canvas>/files/<folderfromstartreport>/download?download_frd=1&verifier=UhWB0yvcjQ1lFXlyWu8lg4x6g2A8uexP9OlQqnou" --location -o test.csv
@gtoney ,
We are giving the Canvas Admins area a little bit of love (especially questions that are really, really old) and just want to check in with you. This will also bring this question new attention.
Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment. Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.
Robbie
To participate in the Instructure Community, you need to sign up or log in:
Sign In
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.