"Uncaught PodioForbiddenError" while updating app using php
Hey,
I want to add / update app items in an existing app using the api. I used the tutorials for making some progress provided at https://developers.podio.com/examples/items. I am using php.
For authentication I use Client ID and Client Secret I generated in my Podio Account and the APP ID and token from the apps settings -> developers page.
For now I'm able to create new app items by checking if an item already exists by using $podio_item_id = $items["items"][0]->app_item_id;
and if not creating by:
$insert = PodioItem::create($app_id, array('fields' => array(
"artikelnummer" => $product["SP_ArtNo"],
"produktname" => $product["Titel"],
"hersteller" => $product["Marke"],
)));
that works for me. But I'm not able to update existing items by using:
$fields = array('fields' => array(
"artikelnummer" => $product["SP_ArtNo"],
"produktname" => $product["Titel"],
"hersteller" => $product["Marke"],
));
$update = PodioItem::update_values($podio_item_id, $fields);
I receive an error like "Uncaught PodioForbiddenError: "The app with id ********* does not have the right view on item with id ***"
What's wrong with my code here?
-
Hi Tom,
there are two possible causes I can think of:
1. the app settings allow only admin users and item creators to update items (look in the settings under "interaction" and check if members can update items)
2. even if 1 is not the case, maybe you are trying to update an item in another app? If you use app authentication, you can only update items in the same app (or you need to get the authorization from the other app as well).Hope this helps,
Stefan -
Hi Stefan,
thanks for your fast reply. I'm really confused about that. I checked your hint and took a look to the interaction settings, everything is fine there, members can comment, create and update APP Items. I also checked your second hint, but the app is also the same, the item was created using the same skript before (with create command), using the same app authentication. Do you probably have any other idea?
Tom
-
Don't use the
app_item_id
when performing API operations (unless you are fetching items based on them). You need to use theitem_id
.The
item_id
is a globally unique identifier for your item. Use that for all API operations unless they specifically call for theapp_item_id
. Theapp_item_id
is just a running id number within that one app. You can tell them apart because theapp_item_id
is much shorter than theitem_id
Please sign in to leave a comment.
Comments
4 comments