Post new item with Contact field => share item
I have an app that has a Contact field which is set as: "Workspace members - invite users". This functionality works fine from within Podio I can put anything in there, even an email, and the user is invited. But using the API I create the item (using App authentication) and when I try to set the profile_id in the contact field, I get PodioError with the following body:
{"error_parameters":[],"error_detail":null,"error_propagate":true,"request":{"url":"http:\/\/api.podio.com\/item\/app\/7625907\/","query_string":"","method":"POST"},"error_description":"One or more of the contacts referenced are no longer valid. Remove the invalid contacts and try again.","error":"field.contact.type.forbidden"}
It works fine with a user that has access to this workspace, but if the user with this profile_id is not a member, then I get this error.
I need to share this item and set the "employee" field. Shouldn't this work?
Thanks,
-
In general it's better if you switch to using contact identifiers (see the bottom here: https://developers.podio.com/index/api ). In addition your API key needs to have an increased trust level for you to do this via the API. Contact support@podio.com with a project description and the client_id of your API key.
/Andreas
-
Well I got in touch with support about trust level etc, but it still does not work so I am taking this back to the forums.
I have tried with the older podio-php API I was using but also with the new version with collections, and still no luck.
This works:$item = new PodioItem( array( 'fields' => new PodioItemFieldCollection( array( new PodioContactItemField(array("external_id" => "employe", "values" => new PodioContact(array("profile_id" => 25436211)))), new PodioDurationItemField(array("external_id" => "duree-travaillee", "values" => 60)), new PodioDateItemField(array("external_id" => "punch-de-fin", array("start" => "2014-06-16 00:00:00"))) ) ), "app" => new PodioApp(8441320) ) ); $item->save();
This doesn't:
$item = new PodioItem( array( 'fields' => new PodioItemFieldCollection( array( new PodioContactItemField(array("external_id" => "employe", "values" => new PodioContact(array("profile_id" => 124756370)))), new PodioDurationItemField(array("external_id" => "duree-travaillee", "values" => 60)), new PodioDateItemField(array("external_id" => "punch-de-fin", array("start" => "2014-06-16 00:00:00"))) ) ), "app" => new PodioApp(8441320) ) ); $item->save();
The only difference is that user with profile_id 25436211 is a member of this workspace, while user with profile_id 124756370 is not. Expected outcome would be that user contact would be set and shared with the user, as configured in the application. Works within Podio itself, just not with the API. I get this error:
PodioBadRequestError: "One or more of the contacts referenced are no longer valid. Remove the invalid contacts and try again."
Any ideas? Can anyone replicate the issue, or better yet, is anyone else successful in doing this?
-
Really disappointed in the outcome of this project. This functionality should work, but doesn't. Got told to take it to support, they did not fix the issue and told me to take it to the forums. No help in the forums... The app is live and not working at the client's for 3 months. I don't know what to tell them.
Please sign in to leave a comment.
Comments
4 comments