REST Post: Invalid Request [SOLVED]

Hello!

I am having a problem when I tried to test the REST Api. The GET commands are responding fine, but when I am trying to create any new Doctype with POST, the server responds with a message 400 Invalid Request.
I am authenticated as the Administrator.
Probably I missed something, but I don’t know what can be. Here are the details of my Post petition:

URL: http://localhost:8000/api/resource/Supplier

Headers:
Content-Type : application/json
Accept: application/json

Content Body:
data={
“supplier_name”: “Supplier”,
“supplier_type”:“Distributor”
}

P.S.: I also tried adding the data on the URL (…/Supplier?data=…) but I am obtaining the same 400 message.

Thank you for your help, best regards!

can you show us your code?

Hi! It is not on code, it is a POST petition using a Firefox RESTClient.

Hello!

It was necessary to add to the header the token X-Frappe-CSRF-Token: token_number of the user.

On this thread is talking about it: CSRF Token Checks Prohibit POST Rest API Calls for a Logged in User

As a petition, I think this should be added or mentioned on the Frappe REST Api guide (https://frappe.github.io/frappe/user/guides/integration/rest_api.html) for other users that could have this problem.

Thank you to @alex_melkoff for finding the thread.