How to get the url of the report using the API

Jump to solution
fabiocunha
Community Explorer

Hi everybody,

I was trying to get the url of a file to be able to read the contents of the file using the following API endpoint

https://myeducationcompany.instructure.com/api/v1/courses/5468/quizzes/32472/reports/8283?include=[file,progress]

and I receive the response below:

{
"id": 8283,
"report_type": "student_analysis",
"readable_type": "Análise do aluno",
"includes_all_versions": false,
"includes_sis_ids": true,
"generatable": true,
"anonymous": true,
"url": "https://myeducationcompany.instructure.com/api/v1/courses/5468/quizzes/32472/reports/8283",
"created_at": "2019-10-16T20:02:17Z",
"updated_at": "2019-10-16T20:02:17Z",
"quiz_id": 32472
}
I think the "url" value returned will be a csv/txt file that I could download it, but it just returns the same value that I use it to call. How can I get the url of the file that contains the report ?
Regards,
Fabio
Labels (1)
1 Solution
tulio
Community Explorer

 @fabiocunha , 

I've find out that you will need to GET https://myeducationcompany.instructure.com/api/v1/courses/5468/quizzes/32472/reports/?includes_all_v... 

This will show you active reports that include all submissions for each student. Note that this will bring the file object that contains data from the student analysis report.

In the example you sent, you will get this response:

[
{
"id": 8228,
"report_type": "student_analysis",
"readable_type": "Análise do aluno",
"includes_all_versions": true,
"includes_sis_ids": true,
"generatable": true,
"anonymous": true,
"url": "https://myeducationcompany.instructure.com/api/v1/courses/5468/quizzes/32472/reports/8228",
"progress_url": "https://myeducationcompany.instructure.com/api/v1/progress/175985",
"created_at": "2019-10-16T09:28:35Z",
"updated_at": "2019-10-16T09:28:36Z",
"progress": {
"id": 175985,
"context_id": 8228,
"context_type": "Quizzes::QuizStatistics",
"user_id": null,
"tag": "Quizzes::QuizStatistics",
"completion": 100,
"workflow_state": "completed",
"created_at": "2019-10-16T09:28:35Z",
"updated_at": "2019-10-16T09:28:36Z",
"message": null,
"url": "https://myeducationcompany.instructure.com/api/v1/progress/175985"
},
"file": {
"id": 499605,
"uuid": "qlKMaV6MEQbunFFj6QCIubjt7TS8bZc6hjts5rrA",
"folder_id": null,
"display_name": "O que você achou dessa disciplina? Survey Student Analysis Report.csv",
"filename": "quiz_student_analysis_report.csv",
"workflow_state": "pending_upload",
"upload_status": "success",
"content-type": "text/csv",
"url": "https://myeducationcompany.instructure.com/files/499605/download?download_frd=1&verifier=qlKMa00000000FFj6QCIubjt7TS8bZc6hjts5rrA",
"size": 4389,
"created_at": "2019-10-16T09:28:36Z",
"updated_at": "2019-10-16T09:28:36Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2019-10-16T09:28:36Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
"quiz_id": 32472
},
{
"id": 8284,
"report_type": "item_analysis",
"readable_type": "Análise de itens",
"includes_all_versions": true,
"includes_sis_ids": false,
"generatable": false,
"anonymous": true,
"url": "https://myeducationcompany.instructure.com/api/v1/courses/5468/quizzes/32472/reports/8284",
"created_at": "2019-10-16T20:02:17Z",
"updated_at": "2019-10-16T20:02:17Z",
"quiz_id": 32472
}
]

View solution in original post