1 follower Follow

cannot attach file to comment through API


i'm trying to attach a valid file_id to a valid comment_id like this

$attribs = array( "ref_type" => 'comment', "ref_id" => (int) $newCommentID );

try {

$action = $api->file->attach( (int) $file_id,$attribs);


catch(PodioError $e)

{ die(print_r($e->body)); }

but I get the following:

[error_description] => The user with id {MY USER ID} does not have the right add_file on comment with id {COMMENT ID}, but can request it

[error] => requestable_forbidden

I don't have a clue what it means. This comment was created by that same app with the same user, file uploaded with that same app/user as well. In External Apps Perms I can see that my app has Full perms. Also I can attach file_id to a task or a space with no problems. This happens only when I try to attach it to comment. Please help!

Thanks, kalin

Kalin Sivov

Please sign in to leave a comment.



This probably means that the user you are authenticated as when attaching the file, is not a member of the space of the item of the comment.

If you login to Podio as the same user you are authenticating with when doing the API request, are you able to go to the item and see the comment you are trying to attach a file to? If this is the case, you probably have some user auth and/or ids mixed up somewhere in your code.

Casper Fabricius 0 votes
Comment actions Permalink

yes, the user sees everything and is added to the space. in addition - the task, the comment, the file - all are created/uploaded with this same user through the api. it's an import script i'm writing so that it creates everything.

i don't think it's an id mix up - i create the the comment and right after this i try to attach the file. (if i don't get a valid comment id my script dies.) the file id is also ok - i upload the file right before the comment, and again - if i get no podio file id, script dies.

about auth - the script runs smoothly all the way until this particular api call with a single authorization. if i bypass this comment-file-attach api call, script continues to run just great.

Kalin Sivov 0 votes
Comment actions Permalink