
Hi Stephan
If you set the value for the field to the following:
[{
"type": "user",
"id": 1234
}]
then it should work without having to do any lookups.
Christian
When a users adds an item, I would like to add the user to one of the field (as a reference to a workspace member).
When I get the item ( https://developers.podio.com/doc/items/get-item-22360), I get a user_id:
"created_by": { "user_id": **** }
That's not enough information to add someone to a field, because you can't add a user to a field: that has to be a workspace member. Since I want to use the App auth flow, I can't use PodioSpaceMember ( https://developers.podio.com/doc/space-members/get-space-member-20735097): it will return PodioForbiddenError.
How can I add a user to a field?
Please sign in to leave a comment.
Hi Stephan
If you set the value for the field to the following:
[{
"type": "user",
"id": 1234
}]
then it should work without having to do any lookups.
Christian
Hi Christian,
Thanks for your suggestion, but that doesn't work for me. This is what I do (PHP):
$fields[27788373] = array("type" => "user", "id" => (int) $created_by['id']);
$update = PodioItem::update($item, array('fields' => $fields), array('hook' => false, 'silent' => true));
This is what it returns:
'error_description' =>
string
'Invalid field 27788373 ('value'): Invalid value None (null): must be integer or null or JsonifiableAdaptable or null' (length=116)
Can you see what's going wrong?
Hi
Sorry, I was too quick (don't thrust my memory). You need to use "value" instead of "id".
Christian
Sorry, that doesn't work either:
'error_description' =>
string
'The app with id 2779441 does not have the right view on profile with id 736088'
What was the value of the id you sent to the API?
The item_id is 46035989. This is what I send to the API:
27788373 (Array, 2 elements)
-
type (String, 4 characters ) user
-
value (Integer) 736088
I am not doing too well here. Can you try the following:
[{"value": {"type": "user", "value": 736088}}]
Fixed! This was the correct value:
[{"value": {"type": "user", "id": 736088}}]
Same problem, different method: I'm having the same problem again, this time with getting tasks: https://developers.podio.com/doc/tasks/get-tasks-77949
Fatal error: Uncaught PodioForbiddenError: "Authentication as an app is not allowed for this method"
Is it possible to use this method with app authentication?
Yes it is. The App doesn't know about any users, you have to authorize as a user.
Sorry, I miss read your question. The correct answer from me should have been: No it's not possible. :)
The documentation is not always correct about the use of App authentication. https://developers.podio.com/doc/tasks/assign-task-22412 states for example that you can use App authencation, but that's wrong since it has no knowledge about any users.
Please let us know when you find miscategorized API operations so we can get them corrected. We have like 250 API operations so fat fingers do result in a few mislabeled items. :(
/Andreas
Sure! Do I send them to support?
Yup :)
Will do!
hi,
iam stuck on this
[{"value": {"type": "user", "id": 736088}}]
this is what i am doing but its not working
$fields[130654] = array([{"value": {"type": "user", "id": 736088}}]); //php doesnt like it
$update = PodioItem::update($item_id, array('fields' => $fields), array('hook' => false, 'silent' => true));
You said you fixed it ? can u please give me the whole code for the field variable above.
Thanks in advance