Adding serial number via api (php + FrappeClient)

I’m trying to integrate erpnext for warehouse management to our own instrument register hosted at our local server. I’m using php and frappe client library.
The problem is I don’ know how to add new “Serial No” via api call.
I have the client configured and I can login and read user info, search serial numbers etc…

    $client = new FrappeClient();
    $result = $client->get(

What parameters should I use to create new serial no?

I’m getting http error 500 with following parameters:

$result = $client->insert(
			"Serial No",
				"name" => "SNR4444",
				"serial_no" => "SNR4444",
				"item_code" => "OurProductCode",
				"company" => "OUR COMPANY"

Any tips are welcome!

I tried adding “Person” via api to keep things simple.
now I got the following error

Server Error

Traceback (most recent call last):
  File "/home/frappe/benches/bench-2016-12-27/apps/frappe/frappe/", line 60, in application
    response = frappe.api.handle()
  File "/home/frappe/benches/bench-2016-12-27/apps/frappe/frappe/", line 115, in handle
    data = json.loads(
  File "/usr/lib64/python2.7/json/", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

in php curl I encode the fileds like this:

,array('data' => json_encode($params['data']) )

This array seems like (in my opinion) correct data format to be sent:

array(1) { ["data"]=> string(21) "{"first_name":"Hepa"}" }

I’m not sure how to debug json parse errors detected by server…

Any suggestions how to proceed with debugging?

Are you using this?

That is the one!
Just noticed that my curl is version 7.14 and requirement is 7.30. Maybe this will cause encoding etc. issues. I’ll update and then return.

now I tested the script in another server (still windows apache), but with more recent version of php/curl (7.49.1).
I’m still getting the same error response.

Has anyone ever managed to get php/curl POST json data calls to ErpNext REST api from Windows / windows server to work?

Try debugging here

sorry, I don’t have the code installed. I use hosted server. Our own server is windows 2008 r2 apache and I’m trying to access the rest interface from PHP code. I can login and read / search but cannot send any new items. The JSON is not accepted.

hi @hexa_dlfn , i want to know, can you send new item from erpnext to other php website for now? have you solved it?

Pls someone tell me.