github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
84 stars 14 forks source link

Change of query parameter delimiter causing server errors. #57

Closed gihanmarasingha closed 4 months ago

gihanmarasingha commented 1 year ago

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.

nixpad commented 8 months ago

@gihanmarasingha 👋 Hi there! Thank you for opening this issue and sharing examples. Sorry that you're experiencing this issue. Since you're calling gh api, this actually doesn't fall under gh classroom' s purview ~so I will transfer this issue to the main CLI repo~ (I was not able to transfer since the organizations are different). Please open this bug report here. They're also requesting the version number of your CLI to help triage so I'm not able to open this up for you. Thanks!

nixpad commented 4 months ago

Closing as stale