Post

3 followers Follow
0
Avatar

Can't retrieve tags for space using App Authentication

I'm trying to retrieve all the Tags on a given space but I've come across two issues.

The PHP library has no function 'get_for_space'. I added one in my code:
/**
* @see https://developers.podio.com/doc/tags/get-tags-on-space-22466
*/
public static function get_for_space($space_id, $attributes = array()) {
return self::listing(Podio::get("/tag/space/{$space_id}/", $attributes));
}

But using that code to make a request I get the following error:
FastCGI: server "/hsphere/shared/php53/bin/php" stderr: PHP Fatal error: Uncaught PodioForbiddenError: "Authentication as app is not allowed for this method"

The application should have access to the specific space's tags.

A request to 'get_for_app' returns all the tags in the application.

Thanks

Hank Szeto Answered

Please sign in to leave a comment.

8 comments

1
Avatar

Hi Hank

The app only has access to what is inside the app. Space tags are naturally at a higher level than the app, which is why this is not allowed. You will have to authenticate as a user to do this.

Christian

Christian Holm 1 vote
0
Avatar

Sorry, I'm new to developing for the Podio Platform; still trying to wrap my head around all the concepts!

I'm trying to mirror Podio content on another website. I'd like to manage content in Podio but view it on another site.

It seems a bit wrong, in my mind, that I cant access Tags (or Files I guess) belonging to a specific Space. But, at least in the case of Files, I can access all Files on all Spaces that belong to an App.

Is there any way to get Tags (and Files) from a Space without having to log in as a user?

Thanks for your help

Hank Szeto 0 votes
0
Avatar

I had my terms mixed up in my head...

What I wanted was tags_for_item($item_id). This function doesn't exist, but PodioItem::get($item) returns the tags associated with the item.

As a side note, items returned by PodioItem::filter($app_id) don't return the tags or files for the item. I don't know if this is a bug or not?

Hank Szeto 0 votes
0
Avatar

To get the tags and files for filter items, you have to ask for them. If you add a query parameter like this: "?fields=items.fields(tags,files)" it should be returned. We are working on some documentation for this feature, but it is not quite ready yet I'm afraid.

Christian Holm 0 votes
0
Avatar

Since you are using podio-php you can do the extra fields thing with:

PodioItem::filter($app_id, array(), array('fields' => 'items.fields(tags,files)');
Andreas Haugstrup Pedersen 0 votes