Issue with item->searchField
Answered|
We're currently building an CSV import application which allows us to connect multiple items from another app, Excel import doesn't support this.
I'm wondering why item->searchField is giving issues. I'm trying to get the item_id by searching for a name in the Full Name (field_id 14494723) field in App Contacts (app_id 1903034).
Request
/item/field/14494723/find?limit=1&sort=created_on&text=Wayne+Gibbard
Response
{"error_propagate"=>false, "error_parameters"=>{}, "error_detail"=>nil, "error_description"=>"Only valid for fields of type 'app'", "error"=>"Only valid for fields of type 'app'"}
|
Thanks,
–Martijn
-
Hi Martin,
you should use the get items operation; for more info check out the thread at https://help.podio.com/entries/21916448-get-an-item-by-field-not-working.
Regards,
George
-
Hi George, thanks for your answer. As we're moving forward we're bumping into the next problem while using item->get(). We're getting the following response from the API which totally doesn't make sense to me.
The app with id 1903034 does not have the right view on item with id 1903034
-
Hi Casper, thanks for your quick reply.
We're using the app authentication. I think we're doing something wrong. I'm trying to search for the value which is in $data[0] and is in one of the items inside the app (1903034) on $fieldId_Contact (14494723).
$getContact = $api->item->get($appId, array('limit' => '1', 'remember' => 'false', 'sort_desc' => 'true', $fieldId_Contact => $data[0]));
-
It looks like that's okay (http://cl.ly/J3mm) so the problem is in the item->get(). Not sure what I'm doing wrong.
-
You should use $api->item->getItems instead of $api->item->get. The latter only takes a specific item id and returns a single item.
For you second question, no, when authenticated as an app you can access all items in that app. The reason you get the error is that you supply the appId as the itemId, because you are using the wrong method.
-
Just a small note to add to what Casper said. We have two methods for getting a collection of items. You probably want to use $api->item->filterItems() instead of getItems as the syntax is much easier to get right. See the formatting here https://developers.podio.com/doc/items/filter-items-4496747
Please sign in to leave a comment.
Comments
9 comments