Searching for text in an item field




  • Casper Fabricius

    App reference fields has the field type "app"  as documented here. "Find items by field and title" can indeed only be used for searching app fields.

    For a case such as yours where you need to synchronize data between Podio and another system, we recommend that you use the "external_id" of an item. When you create the item in the initial import you would set the external_id to something meaningful in the other system, e.g. the primary key.

    Upon subsequent updates you can filter items by this external_id to see if you have that item already and then update it. Currently this is unfortunately also rate limited, but that's something we are working on fixing one way or the other.

    Finally, if you must search text fields, you can try using the  Search in app method.

    Comment actions Permalink
  • MHT Portal

    OK, I have worked out how to set the external_id of an item when creating it.

    But how do I filter by external_id?

    I have previously been filtering by field ID using this:

    $filterParams = array($fieldID => $dataToLookFor);

    $searchParams = array('limit' => 1, 'filters' => $filterParams);

    $result = $api->item->filterItems($appID, $searchParams);

    But I have been unable to work out what to use for the filter parameters to get filtering by external_id.

    I have tried:

    $filterParams = array('key' => 'external_id', 'values' => $dataToLookFor);

    // Returns error: Invalid value u'values': Invalid filtering key


    $filterParams = array('external_id' => $dataToLookFor);

    // Returns error: Invalid value u'my_external_id_string': Must not be basestring (at values)

    So how do I filter by external_id and what are the benefits over filtering by field?

    Will this become a non-rate-limited step in the future - if so, that is definitely a major benefit.



    Comment actions Permalink
  • Casper Fabricius

    If $dataToLookFor is a string containing the external_id you are looking for, this would be the way:

    $filterParams = array('external_id' => array($dataToLookFor)))

    For this call, the API always requires the value of the key (in this case the external_id) to be an array, even if that array only contains a single string.

    Comment actions Permalink
  • Christian Holm

    I have improved the API a little so it now accepts the external_id directly, without being in an array. 

    Comment actions Permalink
  • MHT Portal

    Excellent - thanks very much!

    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk