The user with id # does not have the right view on profile with id #

APW

I am attempting to add a contact to a contact field, the field currently has no information in the app. I originally attempted this through app authentication but found this post on Podio forum and this on here and changed authentication to user.

The user is a workspace admin, the profile_id I am adding is a workspace member and the app has no restrictions on it.

What am I missing and how do I resolve the issue?

$item_id = 1111111;
$field_id = 2222222;
$profile_id = 3333333;

Podio::authenticate_with_password( 'admin_user_email', 'password' );
$item = PodioItem::get_basic( $item_id );
$external_id = 'sign-off-authority';
$contact = new PodioContactItemField( array( 'field_id' => $field_id, 'external_id' => $external_id, 'values' => array( 'profile_id' => $profile_id ) ) );
$item->fields[] = $contact;
$item->save();

results in the following stacktrace:

Fatal error: 
Uncaught PodioForbiddenError: 
"The user with id #### does not have the right view on profile with id ####" 
Request URL: http://api.podio.com/item/1111111 Stack Trace: 
#0 C:\xampp\htdocs\podio-api\lib\Podio.php(322): Podio::request('PUT', '/item/1111111', Array) 
#1 C:\xampp\htdocs\podio-api\models\PodioItem.php(184): Podio::put('/item/1111111', Array) 
#2 C:\xampp\htdocs\podio-api\models\PodioItem.php(67): PodioItem::update(1111111, Array, Array) 
#3 C:\xampp\htdocs\getItems.php(48): PodioItem->save() 
#4 {main} thrown in C:\xampp\htdocs\podio-api\lib\Podio.php on line 286
APW

I found out that either php or podio's php api library was converting my stored value into an array and not retaining it as an integer value. I tried using both user_id and profile_id with neither working, until I realised through output logs what was happening. I had to update the code to this:

$profile_id = 3333333;
$arr = [];
$arr['profile_id'] = $profile_id;
$contact = new PodioContactItemField( array( 'field_id' => $field_id, 'external_id' => $external_id, 'values' => $arr ) );

by creating an array and adding that to the object it retained it's preset format and was accepted by the api. Now the code runs fine.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Align text right in li that does not have class or id

Get user profile picture by Id

add view with user:id

PodioForbiddenError: "The app with id 123 does not have the right delete on item with id 12345"

Does Datepicker have an ID

Does each user only have 1 session id?

Profile ID not stored in User after creation Django

Display user profile url by name instead of ID

what is history id in user profile gmail api?

Save profile data based on user id

User-ID view not populating even though I am following all the right steps

NOT NULL constraint failed: user_profile.user_id

How to get the user profile info thats associated with the user session ID?

Does ID belongs to view model

Is there a way to unban a user ID (Right click copy ID)

column '_id' does not exist although ID have changed to _id

Fetching User by Id does not return

Google Analytics: User does not have sufficient permissions for this profile

Select only if record have none associations, or if the associations does not contain certain user id

show data if you have user id - laravel

I want to show reason in user profile but show reason id in user profile

user._id does not match user._id in mongodb

NOT NULL constraint failed: users_profile.user_id

Getting Profile ID of User from his Jobs using Sessions and LINQ

NOT NULL constraint failed: dashboard_profile.user_id

Get Facebook profile URL from app-scoped user ID

Django "no such column: mains_profile_friends.user_id"

Creating a default value in profile based upon user id

Get SharePoint user ID and profile of an SP site with MS graph api