Sander Bakker
Sander Bakker

Reputation: 621

Add file to Podio item through API call

I wrote the following PHP code:

<?php 

require_once '../podio-php/PodioAPI.php';

//Initalize Podio connection
$client_id = "";
$client_secret = "";

Podio::setup($client_id, $client_secret);


//App ID's
$opname_app_id = 19082139;
$opname_app_token = ""; 

$opname_auth = Podio::$oauth;

Podio::authenticate_with_app($opname_app_id, $opname_app_token);

$attributes = array('ref_type' => 'item', 'ref_id' => 3492);

$upload_result = PodioFile::upload("../questions.php", 'test');

$file_id = $upload_result->file_id;

PodioFile::attach($file_id, $attributes); 

But when I run it I get the following error:

Uncaught PodioForbiddenError: "The app with id 19082139 does not have the right add_file on item with id 3492"

Even though I have the item 3492 is in app 19082139. Could anyone help me fixing this issue?

Upvotes: 0

Views: 156

Answers (1)

Pavlo - Podio
Pavlo - Podio

Reputation: 2013

I'm 99.999999% sure that you can't own item with id 3492. Please check again that you are using item_id and not app_item_id. item_id is unique across whole Podio while app_item_id is unique inside single app.

You can find item_id from Podio UI, from item page, menu 'Action->Developer Info'

Upvotes: 1

Related Questions