MYOBCommunity
Partner Zone
|
|
Partner Zone

Save customer returning empty response

This thread is now closed to new comments.
Some of the links provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
1 REPLY 1
Partner Passionate
4 Posts
Partner
Passionate
Partner

4Posts

0Kudos

0Solutions

Re: Save customer returning empty response

Any ideas on this? I am able to list company files and accounts but create customer call to api still giving developer inactive status, any sugestions?

Highlighted
Partner Passionate
4 Posts
Partner
Passionate
Partner

4Posts

0Kudos

0Solutions

Save customer returning empty response

I am trying to save a customer by sending the parameters as described in documentation.The request being sent is below:

$url =  'https://ar1.api.myob.com/accountright/c3ee2b2a-6b8f-4d36-bef5-5e0c89bf104a/Contact/Customer';
 $param = '{
    "LastName": "Kumar",
    "FirstName": "Amit",
    "IsIndividual": true,
    "IsActive": true,
    "SellingDetails": {
        "TaxCode": {
            "UID": "352a8200-bf57-4723-9165-9f80429afd7d"
        },
        "FreightTaxCode": {
            "UID": "352a8200-bf57-4723-9165-9f80429afd7d"
        }
    }
}';
 

The code is:

    $session = curl_init($url);
 
// $companyFileToken = base64_encode('Administrator:');
// // we setup some headers to tell the API some information like the company file token and api version
// $headers = array(
//     'Authorization: Bearer '.$_SESSION['access_token'],
//  'x-myobapi-cftoken: '.$companyFileToken,
//  'x-myobapi-version: v2',
//  'Content-Type: application/json',                                                                               
//        'Content-Length: ' . strlen($param)
// );
 

// curl_setopt ($session, CURLOPT_HTTPHEADER, $headers);

    // Tell curl to use HTTP POST
    curl_setopt ($session, CURLOPT_POST, true);
    // Tell curl that this is the body of the POST
    curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
    // setup the authentication
    curl_setopt($session, CURLOPT_USERPWD, "Administrator:");
    // Tell curl not to return headers, but do return the response
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    curl_setopt(CURLOPT_SSL_VERIFYPEER, true); // enforce that when we use SSL the verification is correct

    $response = curl_exec($session);
 var_dump($response);





And the response is:

 string(399) "HTTP/1.1 403 Forbidden Content-Type: text/xml Date: Sun, 10 Jul 2016 08:46:02 GMT Server: Mashery Proxy X-Error-Detail-Header: Account Inactive X-Mashery-Error-Code: ERR_403_DEVELOPER_INACTIVE X-Mashery-Message-ID: 6558a863-8823-4bfa-8332-4ae4815be675 X-Mashery-Responder: prod-j-worker-ap-southeast-2a-20.mashery.com Content-Length: 27 Connection: keep-alive
Developer Inactive

Didn't find your answer here?
Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post