Issue while inserting item by api

Server Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 67, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 114, in handle
data = json.loads(frappe.local.form_dict.data)
File “/usr/lib/python3.5/json/init.py”, line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not ‘bytes’
Home
Status: 500

my php code is
case “Item”:
$data = array(‘data’ => array(‘item_code’=>‘Jashan Vinay5’,
‘item_group’=>‘Products’,
‘stock_uom’=>‘Pcs’,
‘thumbnail’ =>‘https://www.jhumarlalgandhi.com/wp-content/uploads/2018/06/fepic-presents-rosemeen-elite-lawn-fancy-collection-of-salwar-kameez.jpeg’,
‘show_in_website’ =>‘1’
));
$ch = curl_init($url.$endpoints.$doctype);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_COOKIEFILE, ‘t1jg.cookie’);
// the rest omitted (see Auth)
$response = curl_exec($ch);
curl_close($ch);
echo $response;
break;

Seems you’re not passing the data in string format

$data = ‘data=’.’{‘item_code’=>‘Jashan Vinay5’,
‘item_group’=>‘Products’,
‘stock_uom’=>‘Pcs’,
‘thumbnail’ =>‘https://www.jhumarlalgandhi.com/wp-content/uploads/2018/06/fepic-presents-rosemeen-elite-lawn-fancy-collection-of-salwar-kameez.jpeg’,
‘show_in_website’ =>‘1’
}’;

Don’t send data in array format. Send it in simple key=value format where key is ‘data’ and value will have hash ‘{}’.

can you explain me how to do that in php

ok Solved it

Can you tell me, how you solve it? i have the same problem