Detect Archived Spaces in API

Answered

Comments

4 comments

  • Andreas Garnæs

    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

    0
    Comment actions Permalink
  • Robert Nall

    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?

    0
    Comment actions Permalink
  • Andreas Garnæs

    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

    0
    Comment actions Permalink
  • Robert Nall

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk