API issue in create individuals customer

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Post Reply
User avatar
SyncEzy
Posts: 47
Joined: Thu Aug 09, 2018 8:42 am
Contact:

API issue in create individuals customer

Post by SyncEzy » Wed Feb 09, 2022 5:26 am

I'm creating individual customer with following api
/api/v1.0/companies/{companyID}/customers/individuals/

but it is giving me following response:
"response" => "{"errors":[{"path":null,"message":"No data to be inserted for individual customer.","value":null}]}"

My params are following:
array:12 [
"Title" => ""
"CustomerType" => "Customer"
"GivenName" => "Test"
"FamilyName" => "Contact hs 102"
"Email" => "[email protected]"
"WorkPhone" => ""
"Fax" => ""
"CellPhone" => ""
"AltPhone" => ""
"Department" => ""
"Position" => ""
"Notes" => ""
]
SyncEzy
https://syncezy.com/
SAAS Integrations Made Easy !
robbertcha
Posts: 416
Joined: Thu Apr 15, 2021 10:07 pm

Re: API issue in create individuals customer

Post by robbertcha » Wed Feb 09, 2022 5:40 am

Hi,

The format of creating an individual customer should be Object, not array, however please add ',' at the end of each column:-

Code: Select all

{
    "Title" :"",
    "CustomerType" : "Customer",
    "GivenName" :"Test",
    ...
}
Robbert
API Developer | simPRO Software Group
User avatar
SyncEzy
Posts: 47
Joined: Thu Aug 09, 2018 8:42 am
Contact:

Re: API issue in create individuals customer

Post by SyncEzy » Wed Feb 09, 2022 6:17 am

Yes its object and there is no error in syntax, this is how it is exactly looking:

$customerInfo = new stdClass();
$customerInfo->Title = '';
$customerInfo->CustomerType = 'Customer';
$customerInfo->GivenName = $firstName;
$customerInfo->FamilyName = $lastName;
$customerInfo->Email = $email;
$customerInfo->WorkPhone = $workPhone;
$customerInfo->Fax = $fax;
$customerInfo->CellPhone = $mobilePhone;
$customerInfo->AltPhone = $altPhone;
$customerInfo->Department = $department;
$customerInfo->Position = $position;
$customerInfo->Notes = $notes;
SyncEzy
https://syncezy.com/
SAAS Integrations Made Easy !
robbertcha
Posts: 416
Joined: Thu Apr 15, 2021 10:07 pm

Re: API issue in create individuals customer

Post by robbertcha » Wed Feb 09, 2022 10:15 pm

Hi,

Yes, the example I provide before is the JSON Object format, I think you might need to use json_encode() to convert php object to json format before posting/patching via simPRO API.
Robbert
API Developer | simPRO Software Group
User avatar
SyncEzy
Posts: 47
Joined: Thu Aug 09, 2018 8:42 am
Contact:

Re: API issue in create individuals customer

Post by SyncEzy » Thu Feb 10, 2022 6:21 am

Okay got it, thank you
SyncEzy
https://syncezy.com/
SAAS Integrations Made Easy !
Post Reply