Using API to add new Customer

I read all infomation at:
And I have some problem when using API to add a new customer:

My URL Request: (POST method)

data={“name”: “Robert”, “customer_group”: “Commercial”, “customer_type”: “Company”, “territory”: “Vietnam”}

And this is my result:
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 52, in application response = frappe.api.handle() File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 97, in handle data = json.loads( File “/usr/lib/python2.7/json/”, line 338, in loads return _default_decoder.decode(s) File “/usr/lib/python2.7/json/”, line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) TypeError: expected string or buffer

Can you help me using or customize to fix this API ?
Thank you so much !

I think the body should be directly the JSON without data= ?

Hi rmehta,
I have tried with:
{ “data”: {“name”: “Robert”, “customer_group”: “Commercial”, “customer_type”: “Company”, “territory”: “Vietnam”} }
{“name”: “Robert”, “customer_group”: “Commercial”, “customer_type”: “Company”, “territory”: “Vietnam”}

But… I still receive error.

see frappe-client/ at master · frappe/frappe-client · GitHub

Thank for your help. Issue fixed.