Hey, Anyone has experience using the REST API as i...
# suitetalkapi
b
Hey, Anyone has experience using the REST API as i am facing a problem which i couldn't debug. When i am using POST, PUT, PATCH api requests. the request body is not being received by the endpoint. in the execution log i can only see an empty file for the request body data. Those User events are actually triggered as i have modified the record.
p
What are you using to send the requests?
b
Copy code
c.request(
	method=method,
	url=url,
	headers=headers,
	auth=auth,
	timeout=timeout,
	json={
		"q": "SELECT * FROM transaction"
	},
)
and i get an error
Copy code
{
  "type": "<https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1>",
  "title": "Bad Request",
  "status": 400,
  "o:errorDetails": [
    {
      "detail": "Invalid SuiteQL request. Provide a valid SuiteQL query in the request body parameter q.",
      "o:errorPath": "q",
      "o:errorCode": "INVALID_VALUE"
    }
  ]
}
the error is due to request body not being parsed by the api.
b
you may want to use an echo service like httpbin.org to see that request you are sending out matches what you expect it to be
ideally you dont send authorization related headers
s
what happens if you change json = {} to data = {}?
b
@battk Ill give it a try. thank.
@Sturla Svendsen I have tried that as well. I got the same result
After testing the request as @battk suggests i found that httpx is not sending the payload for some reason i couldn't figure. i switched to using Python Requests Library and it worked perfectly. Thanks a lot of your help guys.