문제

when we use this API https://app.asana.com/api/1.0/tags, the id and name of the tag is alone exposed... we get this response without colour property

{"data":[{"id":745415432,"name":"niceTag"},{"id":74273131186,"name":"halfBoil"},          {"id":745540236,"name":"DummyTag"}]}

To get the colour property of the tags, we need to individually make a GET request to https://app.asana.com/api/1.0/projects/project-id.

{"data":{"id":123456789,"created_at":"2013-08-15T01:17:32.791Z","modified_at":"2013-08-27T19:14:00.570Z","name":"newPro","notes":"","archived":false,"workspace":{"id":6687953,"name":"t"},"color":"light-yellow","followers":[{"id":987654321,"name":"xxxxx"}]}}

I might be unnecessarily using the server resource for getting colour properties of individual tags. Is there any other way to get the colours?

도움이 되었습니까?

해결책

In most requests for a set of resources, we send what's called the "compact" form - for tags and projects, this includes only the ID and name. However, you can use the opt_fields parameter to request specific fields. For example, if you wanted to get all projects with name and color (ID is always sent), you could use: https://app.asana.com/api/1.0/projects\?opt_fields\=name,color

This works for any fields you need in a collection. For more information on opt_fields and other tricks (like using opt_expand to expand embedded resources) see the documentation on input/output options.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top