Search code examples
podio

Podio REST API attach file incorrect rights to update file


My goal is to copy an existing file from one item 'A' in app 'B', to item 'X' in app 'Y'. First PHP API function PodioFile::copy(file_id) is used to copy the existing file attached to item 'A' and to get the file_id of the copy. Then, after authenticating with app 'Y',

PodioFile::attach(obtained_file_id_from_copy, array("ref_type" => "item", "ref_id" => item_x_id)

is used to attach the copied file to the item 'X' in app 'Y'.

The problem: When trying to attach the file a PodioForbiddenError is given. The response is as follows (error_description is important):

{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/file\/749459918\/attach","query_string":"","method":"POST"},

"error_description":"The app with id 21217623 does not have the right update on file with id 749459918","error":"forbidden"}

I haven't found any helpful information regarding this matter, hopefully someone is able to help me!


Solution

  • You can't access other app's data/files using another app's authentication. You need to authenticate as app B to fetch file/data and change the authentication to app Y to attach/put file or data. Otherwise, try using authenticating as a user who has access to both the Apps so you don't have to change the authentication each time.

    Ref: Podio authentication