Post

2 followers Follow
0
Avatar

Detect Archived Spaces in API

We're looking into putting together a tool to create an aggregated view of tasks across multiple workspaces. We don't want to include spaces that have been archived. I can't find a response in the get spaces calls from the API that details whether or not a space is archived. Is there a way to determine this? What am I missing?

Robert Nall Answered

Please sign in to leave a comment.

4 comments

0
Avatar

Hi Robert,

If you add the query parameter fields=archived to the get space API call, then the response will include a property archived which indicates this.

Hope it helps!

Best,
Andreas

Andreas Garnæs 0 votes
Comment actions Permalink
0
Avatar

Hi Andreas,

Sorry to bring this up again so many months later, but this was an internal project that got shelved for a bit while we dealt with client work. We're getting back to it now and finding that adding the fields=archived parameter isn't providing an archived field as you suggested.

We are using podio-php and attempting to hit the /space/org/{org_id}/ endpoint using the following line:

PodioSpaces::get_for_org($org_id, array('fields' = 'archived');

But we aren't finding an archived attribute in the response. We also tried hitting the /space/{space_id} for each space, again using podio-php and adding the fields=archived parameter, but those calls also do not appear to return archived. Is the option not supported any more or is it specific to select space endpoints?

Robert Nall 0 votes
Comment actions Permalink
0
Avatar

Hi Robert,

When I make the request, it works for me: I get the `archived` attribute. What HTTP request are you making, exactly? Please ensure you're making a request like this:

```
GET /space/org/42?fields=archived
```

Best,
Andreas

Andreas Garnæs 0 votes
Comment actions Permalink
0
Avatar

Hi Andreas,

It turns out the podio-php client library doesn't support undocumented fields. The get_for_org method doesn't support adding a query by default. When it is modified to accept the fields=archived param, the raw response does return the archived field, however the PodioSpace class doesn't contain that field as a property, so it gets ignored when PodioObject wraps the response in a class.

The solution ended up requiring the creation of a subclass of PodioSpace that adds the archived property and extends get_for_org to allow it to accept query strings.

Thanks for the help.

Robert Nall 0 votes
Comment actions Permalink