Combine multiple API calls into a single API call to simplify your code and reduce the number of API calls counted against your daily limit …
Here are highlights from article Query More Data with Nested SOQL Queries in the REST API
1. Introduction to nested SOQL queries:
– Prior to the Summer ’23 release, SOQL only supported one level of parent/child relationship queries.
– Multiple API calls were required to query related objects that were multiple levels deep.
– Example of a REST API call with a one-level nested query.
2. Querying deeper parent/child relationships:
– Prior to the Summer ’23 release, multiple API calls were needed to query deeper parent/child relationships.
– Example of making multiple API calls to query the Account → Contact → Asset → WorkOrder → WorkOrderLineItem objects.
– Extracting Ids from previous queries to use in subsequent queries.
3. Challenges with the previous approach:
– Three API calls were needed to execute multiple SOQL queries.
– Handling and relating records across different responses.
– Managing associations between records from different queries.
4. Expanded depth of nested SOQL queries:
– With the Summer ’23 release, SOQL now supports four levels of nested queries.
– Example of querying the Account → Contact → Asset → WorkOrder → WorkOrderLineItem objects with a single API call.
– Simplifies code and reduces the number of API calls needed.
5. Benefits of using nested SOQL queries:
– Simplifies code by combining multiple API calls into a single call.
– Reduces the number of API calls counted against daily limits.
– Maintains parent/child relationships between records across different responses.
You can read it here: https://sfdc.blog/qnjIr
Source from developer(dot)salesforce(dot)com