Are you getting the file from the SIS Import Status?
SIS Imports - Canvas LMS REST API Documentation
"errors_attachment": {
"id": 59781524,
"uuid": "poiuytrewzxcvbnm",
"folder_id": null,
"display_name": "sis_errors_attachment_6540920.csv",
"filename": "26000000123456_processing_warnings_and_errors2018-10-15+04%3A46%3A19+UTC20181015-2864-1l3asdf.csv",
"workflow_state": "processed",
"content-type": "csv",
"url": "*.instructure.com/files/59781524/download?download_frd=1&verifier=asdfghjkl",
"size": 3794,
"created_at": "2018-10-15T04:46:20Z",
"updated_at": "2018-10-15T04:46:20Z",
"unlock_at": null,
"locked": false,
"hidden": false,
"lock_at": null,
"hidden_for_user": false,
"thumbnail_url": null,
"modified_at": "2018-10-15T04:46:20Z",
"mime_class": "file",
"media_entry_id": null,
"locked_for_user": false
},
You could rename the file after downloading to the display name, or just errors.csv, and your script would see the same file. Or you could download the file, use the display name and match by
regular expression: sis_errors_attachment_(\d+).csv
concatenation: 'sis_errors_attachment_' + importid +'.csv'
Or try these...
SIS Import Errors - Canvas LMS REST API Documentation
This one, takes the import id and returns a JSON response
/v1/accounts/{account_id}/sis_imports/{id}/errors :
{
"sis_import_errors": [
{
"sis_import_id": 456789,
"file": "daily-employees.csv",
"message": "Could not save the user with user_id: 'E123456'. Unknown reason: Something broke with this user. Contact Support with ErrorReport id: 260000088012651",
"row": 3610
},
]
}
This one does not take an import id, last import is returned
/api/v1/accounts/{account_id}/sis_import_errors
Do you know about the Live API?
You can see the different endpoints and responses and choose accordingly.
https://youredu.instructure.com/doc/api/live#!/users.json