Create items having "contact" type fields.

Answered

Comments

6 comments

  • Andreas Haugstrup Pedersen

    As you can see under "contact" here https://developers.podio.com/doc/items the contact field takes a profile id. You cannot create a new contact along with the item. You need to first create the contact with https://developers.podio.com/doc/contacts/create-space-contact-65590 and then use the resulting profile_id when creating the item.

    0
    Comment actions Permalink
  • Sriyan Sampath

    Hi Andreas,

    Thank you in advance. Now It's working.

    0
    Comment actions Permalink
  • Seth Helgeson

    This is my code:

    $profile_attributes = array(

    'address' => $street,

    'zip' => $postcode,

    'city' => $city,

    'organization' => $company,

    'country' => $countryName,

    'phone' => $telephone,

    'mail' => $mail

    );

    PodioContact::create($space_id,$profile_attributes);

    This is my error log: 

    "You cannot use Thomas in this field as they are a space contact and you are using the contact field to share the item. Please remove them to continue."

    "Invalid value "Ha Noi" (string): must be array"

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Hi Seth,

    You have multiple issues. If you look at the model definition you will see that some properties are arrays and not strings: https://github.com/podio/podio-php/blob/master/models/PodioContact.php

    So when you get the error "Invalid value.... (string) must be array" it means that.... you are sending a string where you should be sending an array. Three of your properties above should be arrays.

    I will also encourage you to update your version of podio-php if it's older than two weeks as I've improved the error messages (it'll include the request body so you can see what property is causing the problem).

    As for your other issue: It looks like an item field is configured to accept Workspace Members and share the item with them while you are trying to add a Workspace Contact as a value to the field. Modify your app so the contact field takes contacts and not members.

    /Andreas

    0
    Comment actions Permalink
  • Local Harvest

    Hi,  I just cannot figure out how to create a contact with the Python API.

    There seems to be no mapping for POST /contact/space/{space_id}/

    Help?

     

    Gracias!

    0
    Comment actions Permalink
  • Local Harvest

    Never mind..  figured it out.  There's no Contact class in the python wrapper.  I just added one with just a "create" method in it.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk