0

Forgive me for I am new here. I am working on an API in PHP in order to create a new customer in my customer management system, AMS360, using an API post. I am receiving successful post responses but when I go to the AMS360 UI, I cannot find the customer I just created. I am error checking by creating txt files with the responses, Add_Cust_Result_Dec.txt is empty, while Add_Cust_Result.txt is populated with the response for a successful Post, however the user was not created in my system. Can anyone point me in the right direction to fix this or start debugging this?

My post request looks like this:

$url = "https://api-sandbox.vertafore.com/authgrant/v1/api/Customers";

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $info);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Authorization: Bearer $key",
        'Content-Type: application/json'
    ));

$result = curl_exec($ch);
$result_dec = json_decode($result);
file_put_contents("Add_Cust_Result.txt", $result);
file_put_contents("Add_Cust_Result_Dec.txt", $result_dec);

Below this code, I check if the customer was added successfuly like so:

if (isset($result_dec->CustomerId)) {...}

Considering the $result_dec did not output anything to the txt file, im assuming its empty? Thank you for any advice.

0 Answers0