How to limit subfields in API GET requests' fields

jiaren
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 17, 2024

I am trying to limit the amount of fields returned by the GET request APIs, to ensure standardisation of the return JSONs given that there may be changes to the return values from the GET requests.

For example, for the cards GET request, I can limit the fields as such to name, desc, idList, idMembers, url and labels:

 

https://api.trello.com/1/cards/{id}?key=APIKey&token=APIToken&fields=name,desc,idList,idMembers,url,labels

I am able to successfully limit the fields.

However, I still want to limit the subfields, for example the labels field is an array of JSONs where each element in the labels field contain:

- labels.uses

- labels.color

- labels.idBoard

- labels.name

- labels.id

 

Recently I have noticed that a new subfield has been included which is labels.idOrganization and it is breaking my automations. 

I want to avoid constantly changing my schema when extracting trello values (which I have done so in the past). How can I limit the labels field to only contain subfields that matter to me?

1 answer

1 vote
Rasmus Wulff Jensen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 17, 2024

While it is possible to control what fields are returned on some sub-object (example: Members) Labels apprear to not be one of them.

That being said, for most development practices extra Json Fields added normally don't break existing code (example in C# Deserialization it is out of the box), so I would instead focus on you json parse method and make it recilient against new fields being added in general.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events