Get profile_id from space_id/user_id with App authentication flow

Answered

Comments

17 comments

  • Christian Holm

    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

    0
    Comment actions Permalink
  • Stephan Vierkant

    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?

    0
    Comment actions Permalink
  • Christian Holm

    Hi

    Sorry, I was too quick (don't thrust my memory). You need to use "value" instead of "id".

    Christian

    0
    Comment actions Permalink
  • Stephan Vierkant

    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'

    0
    Comment actions Permalink
  • Christian Holm

    What was the value of the id you sent to the API?

    0
    Comment actions Permalink
  • Stephan Vierkant

    The item_id is 46035989. This is what I send to the API:

    27788373 (Array, 2 elements)

    -
    type (String, 4 characters user

    -
    value (Integer736088

    0
    Comment actions Permalink
  • Christian Holm

    I am not doing too well here. Can you try the following:

    [{"value": {"type": "user", "value": 736088}}]

    0
    Comment actions Permalink
  • Stephan Vierkant

    Fixed! This was the correct value:

    [{"value": {"type": "user", "id": 736088}}]

    0
    Comment actions Permalink
  • Stephan Vierkant

    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? 

    0
    Comment actions Permalink
  • Carl-Fredrik Herö

    Yes it is. The App doesn't know about any users, you have to authorize as a user.

    0
    Comment actions Permalink
  • Carl-Fredrik Herö

    Sorry, I miss read your question. The correct answer from me should have been: No it's not possible. :)

    0
    Comment actions Permalink
  • Carl-Fredrik Herö

    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.

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    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

    0
    Comment actions Permalink
  • Carl-Fredrik Herö

    Sure! Do I send them to support?

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    Yup :)

    0
    Comment actions Permalink
  • Carl-Fredrik Herö

    Will do!

    0
    Comment actions Permalink
  • Stephen Grealy

    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

    1
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk