Issue with item->searchField

Answered

Comments

9 comments

  • George

    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

    0
    Comment actions Permalink
  • Martijn Snels

    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

    0
    Comment actions Permalink
  • Casper Fabricius

    That error message usually means that you are using app authentication, and that you are trying to access an item that is not in the app you are authenticated as.

    0
    Comment actions Permalink
  • Martijn Snels

    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]));

    0
    Comment actions Permalink
  • Martijn Snels

    Another quick check, to get and update items the App didn't create by itself we need to be authenticated as an user?

    0
    Comment actions Permalink
  • Christian Holm

    You can always get the item. Updating depends on the setting in the app builder (let other members edit...).

    0
    Comment actions Permalink
  • Martijn Snels

    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.

    0
    Comment actions Permalink
  • Casper Fabricius

    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.

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    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

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk