Jump to content

Create contact - contact[contact_type_ids] is invalid


 Share

Recommended Posts

Hi all
I'm starting out on a website integration for our business, I've got my PHP class working with authentication now dipping my toes into creating a contact. 

When I send the request to create a contact, I get this returned.
 

array (
  0 => 
  (object) array(
     '$severity' => 'error',
     '$dataCode' => 'Validation',
     '$message' => 'contact[contact_type_ids] is invalid',
     '$source' => 'contact[contact_type_ids]',
  ),
)

When I pull out all my contact_types, I get the following returned which suggests that I have two setup in my Sage Accounting package (live) with CUSTOMER & SUPPLIER as their ids.

(object) array(
   '$total' => 2,
   '$page' => 1,
   '$next' => NULL,
   '$back' => NULL,
   '$itemsPerPage' => 20,
   '$items' => 
  array (
    0 => 
    (object) array(
       'id' => 'CUSTOMER',
       'displayed_as' => 'Customer',
       '$path' => '/contact_types/CUSTOMER',
    ),
    1 => 
    (object) array(
       'id' => 'VENDOR',
       'displayed_as' => 'Supplier',
       '$path' => '/contact_types/VENDOR',
    ),
  ),
)

I had assumed therefore I'd be creating an array to send the data like the below:

$data = array(
      'contact' => [
        'name' => 'Test Name',
        'contact_type_ids' => 'CUSTOMER',        
      ]
    );

But I get the error above. 

Can anyone point me in the right direction, am I looking in the wrong place for my contact types?

Many thanks!

 

Matt

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...