Discussion Forums

creating companies

 
New Member
3 posts

Have successfully added contacts and activities to my account using the api but cannot seem to create companies.  The documentation dosen’t seem to be complete and there are no examples available to show how to create a company.

this is my code

$companyData = array(
  ‘name’ => $businessname,
);

$company = $solve360Service->addCompany($companyData);

if(isset($company->errors))
{
  // Mail yourself if errors occur
  mail(
      USER,
      ‘Error while adding contact to Solve360’,
      ‘Error: ‘ . $company->errors->asXml()
  );
}

Any clues as to what i’m doing wrong?  Thanks in advance.

Avatar
Administrator
3952 posts

What URI are you posting the response to?  For documentation refer to the Contacts spec and replace the segment name /contacts/... with /companies/...  e.g. POST https://secure.solve360.com/companies e.g.

curl -'{email}:{token}' --X POST -'Content-Type: application/xml' -'<request><name>Test Company</name></request>' https://secure.solve360.com/companies 

New Member
3 posts

I’m using the Solve360 object provided in the zip file and making the api call through the addCompany method.  Does this not automatically post to the correct URL?

New Member
3 posts

ok figured it out, because i wasn’t sharing ownership, i couldn’t see it in my account.  Was using another users api key..this did it:

$companyData = array(
  ‘name’ => $businessname,
  ‘ownership’ => ‘{putyourgroupidhere}‘,
  ‘relateditems’  => array(‘add’=>array(‘relatedto’=>array(‘id’=>array($contactId))))
);

$company = $solve360Service->addCompany($companyData);

Thanks anyway for response