Account Reports API Using Updated After Parameter

JesseBrand
Community Member

Hi, all. I'm trying to do an API call to generate a 'proserv_student_submissions_csv' report with the 'updated_last' parameter. 

 

I saw that parameter was available after running the available reports request and getting this for that report's available parameters: 

{
'enrollment_term_id': {'required': False, 'description': 'The term to report on'},
'start_at': {'required': True, 'description': 'The beginning date for submissions'},
'end_at': {'required': True, 'description': 'The end date for submissions'},
'include_all': {'required': False, 'description': 'Include unsubmitted and deleted submissions'},
'updated_after': {'required': False, 'description': 'An ISO-8601 timestamp. Any objects with an updated_at timestamp less than this parameter will be excluded.'}
}

 

1) I ensured the date string being passed is in ISO-8601 format and set to 3 days prior to the current date.

2) I tried multiple ways to pass the parameter. Most resulted in an error. The below runs successfully and generates the report. However, the report is still generated with all records. 

3) When the report is generated, it shows these as the parameters that were passed ('updated_after' is missing):

parameters 
{'locale': 'en', 'extra_text': 'Term: All Terms; Start At: ; End At: ;'}

 

Below is the python code that I ran for report generation, which was successful:

post_headers = {
     'Authorization': token
}
post_params = {
     'updated_after': iso_date
}

post_url = '<my school's canvas>/api/v1/accounts/1/reports/proserv_student_submissions_csv'

post_response = requests.post(post_url, params = post_params, headers = post_headers)

if post_response.status_code == 200:
     print('Success')
else:
     print(f"Request failed with status code {post_response.status_code}: {post_response.text}")

 

What is the proper structure to pass the 'updated_after' parameter? Any information or assistance is greatly appreciated.

Labels (3)
0 Likes