Dear all,
I’m trying to create a Purchase Receipt with Serial Number Items to ERPNext thru the RESTful Web-Service API. The Purchase Receipt without Serial Number Items works fine. But I’m having trouble passing the Serial Numbers in the correct format.
When I receive a Purchase Receipt RESTful JSON file FROM ERPNext, multiple serial numbers are passed in one string separated by a line-break. This then looks similar to this:
111\n222
(In my example 2 Serial Numbers, 111 and 222).
When I pass it back in the same format or also with a space, I’m getting the following error message return from ERPNext:
com.sap.b1i.xcellerator.XcelleratorException: XCE212 Error performing the HTTP-call, HTTP-status is 500, INTERNAL SERVER ERROR
{"exc":"[\"Traceback (innermost last):\\n File \\\"/home/erp/frappe-bench/apps/frappe/frappe/app.py\\\", line 74, in application\\n response = frappe.api.handle()\\n File \\\"/home/erp/frappe-bench/apps/frappe/frappe/api.py\\\", line 111, in handle\\n data = json.loads(frappe.local.form_dict.data)\\n File \\\"/usr/lib/python2.7/json/__init__.py\\\", line 338, in loads\\n return _default_decoder.decode(s)\\n File \\\"/usr/lib/python2.7/json/decoder.py\\\", line 366, in decode\\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\\n File \\\"/usr/lib/python2.7/json/decoder.py\\\", line 382, in raw_decode\\n obj, end = self.scan_once(s, idx)\\n ValueError: Expecting , delimiter: line 1 column 362 (char 361)\\n\"]"}
It would be great if somebody would have an input about the JSON format which needs to be passed in the serial_no property to ERPNext when using the RESTful API.
Thank you,
David
It seems, input json is not in required format. You can validate json via http://jsonlint.com/
2 Likes
Thank you @saurabh6790 I found the issue, I put it as instead of , now it is working fine.