Missing required parameter q with POST request

Hello guys,

I am trying to use C++ to interact with my DB. While I am trying to use POST request to send my query, it seems the API cannot capture my parameters. Specifically, it always return 400 bad request. error message is {“error”: “missing required parameter \ “q””}

In the code, I have something like
/header part/
“POST /query http/1.1\r\n”
/other parts of header/
"/r/n/r/n" /* end of header*/

/request body/
“q=show+databases” or “q=show+databases” //won’t work, return 400

I have also tried to use jaon format as string, however, all of them will return me the aforementioned error. I am wondering if someone can help me with this please? Thank you!!!

Is your Content-Type correct? For this type of query it should be application/x-www-form-urlencoded.

Hello Daniel,

I have found the problem. Although I set the correct content type, I did not format it properly. Many thanks to your reply as I completely overlooked such a small detail!

1 Like