Return specific fields only in response body

I only want to return specific attributes in my responseBody (eg. Country and Effective dates only). How will I do that with below response I receive. I am new to this one. Thanks for the help:

{
“data”: [
{
“id”: “clientNumber=00000252&addressCategory=001&effectiveDate=2021-05-01”,
“type”: “addresses”,
“attributes”: {
“country”: “USA”,
“city”: “New York”,
“deliveryMethod”: “000”,
“contactName”: null,
“telephone2”: “2125096996”,
“telephone1”: “2125096995”,
“faxWork”: “2125096997”,
“expiryDate”: “9999-12-31”,
“effectiveDate”: “2021-05-01”,
“addressLanguage”: null
}
},
{
“id”: “clientNumber=00000252&addressCategory=006&effectiveDate=2021-04-08”,
“type”: “addresses”,
“attributes”: {
“country”: “FRA”,
“city”: “Mosta”,
“deliveryMethod”: “500”,
“contactName”: null,
“telephone2”: null,
“telephone1”: null,
“faxWork”: null,
“expiryDate”: “9999-12-31”,
“effectiveDate”: “2021-04-08”,
“addressLanguage”: null
}
},
{
“id”: “clientNumber=00000252&addressCategory=022&effectiveDate=2020-02-20”,
“type”: “addresses”,
“attributes”: {
“country”: “USA”,
“city”: “New York”,
“deliveryMethod”: null,
“contactName”: “BD”,
“telephone2”: “2125096996”,
“telephone1”: “2125096995”,
“faxWork”: “2125096997”,
“expiryDate”: “9999-12-31”,
“effectiveDate”: “2020-02-20”,
“addressLanguage”: “001”
}
}
]
}

Hi @aviation-astronaut-6 :wave: Welcome to the community :partying_face:

Can you please a bit more here? Are you expecting the response to be filtered while displaying? If so, you need to refer the documentation that if the filtering is possible by adding the extra params to the request. Else you are looking to filter the response as such and create the subset with keys you had mentioned above.

Kindly share more details or screenshot :blush:

1 Like

Hi @bpricilla

I just want the responseBody to display specific attributes/fields only from that result. Like, I want to display the ‘id’ and under attributes, I only want the ‘country’ & ‘city’ only. No value filtering. Just like selecting a specific columns in a table. Thanks for the help

Okay in that case you should have such details in your API documentation. Is that a public API?

Hey @aviation-astronaut-6 :wave:

Just to add to what @bpricilla has mentioned, what you see in response body is fully controlled by the backend API service you are using and it is not something you can select using Postman (unless it’s GraphQL API) :slightly_smiling_face:

1 Like