Post

1 follower Follow
0
Avatar

Searching for text in an item field

I am working on a system that will monitor and update items in a Podio app automatically.

I have it basically working, but there is a problem step...

I get the original data from a web server and then I have to search for a matching record on Podio which may or may not exist.

I have a unique ID field in the Podio app so I know exactly what I am looking for.

Currently I am using filterItems (via the PHP client) but that is a rate-limited step and since it is a call that I will have to make frequently, that will be an issue.

I also tried using "Find items by field and title" but that returns: "Only valid for fields of type 'app'".

I don't know what makes a field an 'app' field but I couldn't find any setting for this unless it refers to "App Reference" fields which are not what I need.

 Is there a way to find text in a field without a rate-limited step?

Thanks,

Sarah

MHT Portal Answered

Please sign in to leave a comment.

5 comments

0
Avatar

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.

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

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

and:

$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.

Thanks,

Sarah 

MHT Portal 0 votes
Comment actions Permalink
0
Avatar

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.

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

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

Christian Holm 0 votes
Comment actions Permalink