CX Sales & B2B Service - Retrieve 3 levels of object data with a single REST API call

Hi,

In this post, I'll cover how to retrieve 3 levels of object data in a single REST API Call with GET. It is useful if you want to reduce the number of API calls and get optimal data query performance.

Here are the details,

For example, I want retrieve data from this data structure -

Contact (Parent)

--Address (Child)

----Address Purpose (Grand Child)


I can use query parameter 'expand=' like below,

https://url/crmRestApi/resources/latest/contacts?q=PartyNumber='17012'&expand=Address,Address.AddressPurpose


Moreover, if I want to return specific attributes from each level, I can use query parameter 'fields=' like below,

https://url/crmRestApi/resources/latest/contacts?q=PartyNumber='17012'&expand=Address,Address.AddressPurpose&fields=FirstName;Address:Address1,Address2;Address.AddressPurpose:Purpose


Thanks,

Adam Liu

Comments

Popular posts from this blog