Curl 400 Bad Request

Hi Support,

Currently I am trying to use Curl to send a simple query GraphQL via API V2.
However , I encountered 400 Bad Request.
I ran this command in Windows 10 command mode directly as following.

curl -X POST -H “Content-Type:application/json” -H “Authorization:xxxxx” “https://api.monday.com/v2” -d ‘{“query”:“{boards{id,name}}”}’ -v

Please kindly advise where should I adjust.
Thank you.

Best Regards,
Steven

Hey @steven.su :slight_smile: Welcome to the community, glad to have you here!

Other clients have also had trouble with that example, I believe the Windows command prompt is picky about quotation marks… :sweat_smile:

Can you try the following command instead (using double quotes and no single quotes) and let me know if it works?

curl -X POST -H “Content-Type:application/json” -H “Authorization:xxxxx” “https://api.monday.com/v2” -d "{\"query\":\"{boards{id,name}}\"}" -v

Hi @dipro ,

Yes, it works !
Actually I had tried to change single-quote to double-quote , but I did not add \ in in front of each double-quote between this two double-quotes.
Thanks a lot !

Steven

2 Likes

Amazing! Good to know :slight_smile:

2 Likes

Returning 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn’t follow the rules. The client SHOULD NOT repeat the request without modifications. It means that the request itself has somehow incorrect or corrupted and the server couldn’t understand it. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method . Therefore, it prevents the website from being properly displayed. To fix a 400 Bad Request error, it is best to start diagnosing the issue from the client side itself. Complete the steps outlined in this section to help diagnose and correct the error.

  • Check for errors in the URL.
  • Clear Browser Cache and cookies.
  • Clear DNS Cache.
  • Check your File upload Size.
  • Deactivate Browser Extensions.