Post requests not working

Dears,

I tried Post method and did’t work wit me, I tried it on Customer and Item with no hope, Requests as below,

URL: https://xxxx.erpnext.com/api/resource/Customer
Method: POST
Body: { “doctype” : “Customer”, “customer_name”: “Customerxx”, “customer_group”:“Commercial”, “customer_type”: “Company”, “territory”: “Egypt” }
Response: 400 Bad Request

ALSO, I tried the same post method and same body with the below URL:
URL: https://xxxx.erpnext.com/api/resource/Customer?data={ “doctype” : “Customer”, “customer_name”: “Customerxx”, “customer_group”:“Commercial”, “customer_type”: “Company”, “territory”: “Egypt” }

and response is 400 also

Should I enable something in configuration to enable the POST ? or what’s wrong.

Thanks,

Can you share your exact code?

@Pawan , i tried that from dhc chrome extension , I didn’t integrated it yet but am looking to do so with PHP, All GET and PUT request working fine except POST,

Can you try this $ curl -X POST https://xxxx.erpnext.com/api/resource/Customer and POST without any data and see if you get any error?

It working fine now,
I think the problem was in cookies, in dhc chrome client, I must call login before each post operation, when i do that, the post working fine.

Thanks @Pawan for your support.