Get List Enrollments bug/maybe maybe not?

cschexnayder
Community Novice

I recall a post where trying to get the state of an enrollment you had to use state[]=deleted....or state[]=active

When I first looked at the request parameters to List enrollments end point (

/api/v1/courses/:course_id/enrollments)

I took the state parameter to mean you could send it an array of status'.  So using RestSharp I attempted to do this but noticed that I only get the invited and active enrollment.

So me being me, before I coded I was using PostMan to test and using the below array in the body, all status' do come back in the response.  Now I know in RestSharp module you can only have one parametertype of RequestBody which I have.

My body

{"state": ["active","completed","deleted","creation_pending"]}

The other think I noticed is in postman if you don't specify content-type=application/json in the header, the api call will only get the defaults (active and invited)......so made sure this was also set in my RestSharp request.  No matter what I do to get multiple status' in the same call using restsharp, it only get the default.  Now I can pass the below and get each individual status:

{"state": ["active"]}

or

{"state": ["completed"]}

and those do work.  wondering if anyone else has seen this behavior?  If so, how to resolve?

My solution was to just loop through each status and get individually, but it's bothering me that it works in postman and not c#

Now I've used the same format on other api calls where in the canvas documentation says you "May pass in array or string." for example sis_section_id[], and it works there.  Just weird.  Anyone?

Labels (2)
0 Likes