gh-classroom icon indicating copy to clipboard operation
gh-classroom copied to clipboard

Change of query parameter delimiter causing server errors.

Open gihanmarasingha opened this issue 1 year ago • 1 comments

I'm using the REST API. When I run:

gh api \                         
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  '/assignments/XXXXXX/accepted_assignments?page=1&per_page=100'

where XXXXXX is an actual assignment ID, I get an error message

{
  "message": "Server Error",
  "documentation_url": "https://docs.github.com/rest/classroom/classroom#list-accepted-assignments-for-an-assignment"
}

This used to work fine (a couple of days ago). If I remove the ampersand from my query parameter, the query succeeds. That is, the following works:

gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  '/assignments/XXXXXX/accepted_assignments?page=1per_page=100'

I imagine there has been a change to the backend causing these issues. Are the changes or the preferred method of passing multiple queries documented somewhere?

I tried using the -F flag, as recommended in the API Documentation, but I get an error message. For example, when I try

gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  --method GET
  '/assignments/XXXXXX/accepted_assignments'
  -f page=1 -f per_page=100

I get the message

{
  "message": "Server Error",
  "documentation_url": "https://docs.github.com/rest/classroom/classroom#list-accepted-assignments-for-an-assignment"
}

It does work if I use -f page=2per_page=100 instead.

Please can you document how multiple query parameters are meant to be handled and ensure that your tests include handling of multiple query parameters.

gihanmarasingha avatar Nov 05 '23 17:11 gihanmarasingha