Including More Resources
Our API offers a powerful feature to enhance data retrieval: the includes query parameter. Available in nearly all API requests, this parameter enables you to request additional, related resources within a single API call.
Frequently, a primary resource has relationships with other resources that are not fetched by default in an API response. For example, a payment link might be related to both a customer resource and payment details. Utilizing the includes query parameter allows you to fetch these related resources seamlessly. In our API documentation, the term includeable specifies which attributes or resources can be included in the response.
The includes query parameter is compatible with various API endpoints, including those for listing, creating, and updating resources. It also supports the inclusion of multiple related resources simultaneously through the includes array. This capability ensures a comprehensive retrieval of information in a single request, optimizing both the completeness and efficiency of data retrieval.
We employ eager loading for the included resources to ensure rapid response times, even for recursive and nested resources. However, it's important to use this feature wisely as extensively including deep nested resources across multiple list requests may impact processing speeds.
How It Works
When including a resource and its nested relations in a request, Payiano employs a strategic approach to ensure that the resource is not duplicated within the nested one. Here's how it works:
- When a request includes a customer resource that has a nested billing address, and if the billing address itself references back to the customer, Payiano intelligently avoids duplicating the customer resource within the billing address. This not only prevents redundancy but also simplifies the response structure, ensuring that the same resource is not repeated unnecessarily within its nested relations.
- In this scenario, the Payiano intelligently avoids duplicating the customer resource is already loaded as one of the parents of the billing address resource. Including it again within the billing address would be redundant and unnecessary.
This logic ensures efficient data representation and avoids unnecessary duplication when retrieving nested resources. It simplifies the response structure by preventing the same resource from being repeated within its nested relations.
By leveraging the includes query parameter, developers can significantly enhance the functionality and performance of their API integrations, achieving more detailed and connected data insights with minimal overhead.