# New additions to the API: team memberships, project default views, and compression

**URL:** <https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084>\
**Category:** Platform News\
**Tags:** api\
**Created:** [18 December 2019 01:51 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084 "2019-12-18T01:51:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Trollo](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/joe_trollo/32/4025_2.png) [@Joe\_Trollo](https://forum.asana.com/u/Joe_Trollo)\
**Post date:** [18 December 2019 01:51 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/1 "2019-12-18T01:51:48Z")

</div>

Hello all! I have a short list of new additions to our API that we’ve accumulated and are ready to share with you.

## Team Memberships

We’ve introduced a new resource in the API representing users’ memberships within teams, similar to our existing project membership and workspace membership resources. The membership objects have four fields in them: `user`, `team`, `is_guest`, and the usual `resource_type` field. All fields are read-only.

You can query for team memberships with the following three routes:

- `GET /team_memberships` - requires either a `team` parameter or a `user` and `workspace` parameter
- `GET /users/<user-gid>/team_memberships` - requires a `workspace` parameter
- `GET /teams/<team-gid>/team_memberships` - optionally takes a `user` parameter

And you can get an individual membership by ID with `GET /team_memberships/<team-membership-gid>`

## Project default view

Project objects in the API now have a `default_view` field on them, which is one of `"list"`, `"board"`, `"calendar"`, or `"timeline"`. This determines the view that users see when they initially open the project in the Asana web app. This field is also writeable, so you’re free to have your apps change the default view as well. Note, though, that changing the default view to a different format will also clear any default sort or filters that were set on the project. (This matches what happens in the web app when a user changes views.)

## Gzip compressed responses

We now support Gzip compression in the API, and you can request that responses be compressed by sending an `Accept-Encoding: gzip` header in your request. If the API returns a compressed response, it will have a corresponding `Content-Encoding: gzip` header. Many popular HTTP clients will automatically handle decompressing responses, so you might not need to do anything special beyond sending the right header! (For example, Python’s `requests` package will automatically uncompress `gzip` responses.)

If you are pulling lots of data from our API, compression can potentially improve performance, as it will take less time to send your app all the packets for the smaller, compressed response.

---

<div class="post-metadata">

**Author:** ![Joe\_Trollo](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/joe_trollo/32/4025_2.png) [@Joe\_Trollo](https://forum.asana.com/u/Joe_Trollo)\
**Post date:** [18 December 2019 01:52 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/2 "2019-12-18T01:52:02Z")

</div>

Pinned on 18 December 2019 01:52 UTC



---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [18 December 2019 06:19 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/3 "2019-12-18T06:19:02Z")

</div>

> [@Joe\_Trollo](#):
>
> Gzip compressed responses

Hmm, I tried this with a .NET HttpWebRequest which is supposed to support compression. I verified that it sent the correct header in the request, but the response didn’t contain the expected header value - from my debug window:

```
? _request.Headers["Accept-Encoding"]
"gzip"

? result.Headers["Content-Encoding"]
""

```

@Joe_Trollo, any thoughts?

---

<div class="post-metadata">

**Author:** ![Joe\_Trollo](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/joe_trollo/32/4025_2.png) [@Joe\_Trollo](https://forum.asana.com/u/Joe_Trollo)\
**Post date:** [18 December 2019 08:43 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/4 "2019-12-18T08:43:00Z")

</div>

Hi Phil,

I _think_ what you want in this case is actually to set `request.AutomaticDecompression = DecompressionMethods.GZip` on your request (taken from [these docs](https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.automaticdecompression?view=netframework-4.8#System_Net_HttpWebRequest_AutomaticDecompression)). I suspect that, because there is a separate canonical way of declaring that you want to use compression, the `HttpWebRequest` is ignoring any manual `Accept-Encoding` headers you try to set.

If you want to verify the headers of your request, a good tool to use is [httpbin.org](https://httpbin.org). If you make a request to `https://httpbin.org/headers` the body of the response will contain the request headers, allowing you to more easily verify what headers your app sent.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [18 December 2019 14:54 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/5 "2019-12-18T14:54:12Z")

</div>

> [@Joe\_Trollo](#):
>
> set `request.AutomaticDecompression = DecompressionMethods.GZip`

Yes, that’s exactly what I did; sorry, should have shown you my actual code. I was just showing the `Accept-Encoding` element of the Headers array just before it went out over the wire, but that element got set by my using the `AutomaticDecompression` statement. FYI I tried both

`request.AutomaticDecompression = DecompressionMethods.GZip;`  
and  
`request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;`

as the latter is what is generally shown in online examples; but in both cases, the `Content-Encoding` header of the response shows an empty string.

I did try the [httpbin.org](http://httpbin.org) suggestion and it also showed a blank `Content-Encoding` header in the response.

Thoughts?

  

**EDIT:**

Found [the answer here](https://stackoverflow.com/questions/42004756/how-to-determine-whether-content-returned-by-net-httpclient-is-gzipped)!

> When the `HttpClientHandler` is set to use `AutomaticDecompression` then the value in content is successfully requested as GZip and then decompressed correctly. But the `ContentEncoding` value in the response headers collection is empty.

Geez, thanks .NET for doing extra work that we don’t need.

So apparently I have no way of verifying whether this new GZip option is working or not! The only thing I can think of is to run my Flowsana refresh-data operation which does a whole bunch of Asana calls and time it with and without compression. Not sure how good of a test that will be, though, since other factors like rate limiting could interfere with the timing.

---

<div class="post-metadata">

**Author:** ![denishacquin](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/denishacquin/32/42768_2.png) [@denishacquin](https://forum.asana.com/u/denishacquin)\
**Post date:** [16 January 2020 14:25 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/6 "2020-01-16T14:25:55Z")

</div>

Hello,

How can I find out the team permission for a give project?

- I can know which team is linked to a given project;
- I can know if the authed user is part of that team;
- BUT I can’t know if that team is set as “comment only” ☹

 ![asana](https://us1.discourse-cdn.com/asana/original/3X/e/1/e129840181aa9a023cc1133c7f25ef6e63488729.png)

Original post here:

> [@Fetching project permission (write/comment only) for a team](https://forum.asana.com/t/fetching-project-permission-write-comment-only-for-a-team/71210/5):
>
> It looks like it. I can know which team is linked to the project; I can know if the user is part of that team; I can’t know if that team is set as “comment only” frowning

Any help ? This is critical for us. Thanks!

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [16 January 2020 15:15 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/7 "2020-01-16T15:15:56Z")

</div>

Hi @denishacquin,

Here’s your answer - it’s not possible, because it wouldn’t be accurate since it can be overridden at the user level:

> [@How to determine if a project is a comment-only project?](https://forum.asana.com/t/how-to-determine-if-a-project-is-a-comment-only-project/26224):
>
> I understand that [there are API calls which can tell us user-specific data](https://asana.com/developers/api-reference/project_memberships) about individual users’ project memberships. But how do we obtain the setting of the Members of [Team] and task collaborators option for a particular project, to determine whether it’s a “comment-only” project?

---

<div class="post-metadata">

**Author:** ![Edward\_R](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/edward_r/32/83180_2.png) [@Edward\_R](https://forum.asana.com/u/Edward_R)\
**Post date:** [10 August 2021 15:11 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/8 "2021-08-10T15:11:14Z")

</div>

Phil,

I understand how a users membership can be overridden by an explicit project membership. However, without being able to query the permission from the team association with the project there is no way to know what the “implicit” users can do on the project (edit or only comment). That is the value of having the write\_access exposed for team-\>project associations.

So either

1. having a way to query the team-\>project write\_access  
OR
2. having an endpoint on the project that allows you to query ALL members (either explicit or implicit via the team)

Would allow better insight into how users are configured in asana.

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [11 August 2021 03:56 UTC](https://forum.asana.com/t/new-additions-to-the-api-team-memberships-project-default-views-and-compression/69084/9 "2021-08-11T03:56:11Z")

</div>

I hear you, @Edward_R - no argument from me!

I don’t work for Asana, though, so all we can do is ask them to have it added to the API.

cc: @Andrew-asana
