I want to create and update customers, order in Magento-2. But I am facing problem in how to pass data to create customer. Can anyone give me an example for this?
I am passingpassed data like:
$cusData = "rest/V1/customers/{'customers': {'customer':{'email':'[email protected]','firstname':'Jhon','lastname':'test'}}}";
$cusMethod = 'PUT';
$cusJsonData = getData($token,$cusData,$cusMethod);
function getData($token,$data,$method)
{
try{
$requestUrl = BASEURL.$data;
$ch = curl_init($requestUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
return curl_exec($ch);
}catch(Exception $e){
echo $e->getMessage();
}
}