Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 4 characters in body
Source Link

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();
    }
}   

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 passing 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();
    }
}   

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 passed 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();
    }
}   
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
BornCoder
  • 1.5k
  • 5
  • 20
  • 46

Magento 2 Rest API: create / update order,customer information

added 734 characters in body
Source Link
BornCoder
  • 1.5k
  • 5
  • 20
  • 46

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 passing 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();
    }
}   

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 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 passing 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();
    }
}   
added 4 characters in body; edited tags
Source Link
Loading
Source Link
BornCoder
  • 1.5k
  • 5
  • 20
  • 46
Loading