- Order Processing
V3 Deprecation Notice
We are planning on sunsetting Version 3 of the WPS API and Data Depot on August 31st, 2018.
One of the most practical and convenient functions of the API, includes are essentially a way to nest one service within another service based on the relationship they have with each another.
This important feature makes your requests much more efficient and greatly reduces the need to make multiple requests to gather all the pieces of data you desire. For those with a database background, think of includes as a "join". With includes you are essentially joining another related database table to the primary entity and nesting it under each item in the response.
Works with any valid relationshipIncludes are not limited to parent/child relationships; you can also get child/parent relationships. This allows you to incorporate any parent service within a child service provided they have appropriate relationship to one another.
You can also combine multiple includes to produce even more powerful queries. Just separate each include with a comma (,).
You can take includes a step further and retrieve an includes associations as well. Just separate each association by a dot (.). A request like this will include all the Items associated to a Product, but it will also include the Images associated to those Items as well.
It doesn't stop at one level either. You can essentially include an infinite amount of relationship data on an include! You can go as deep as the relationships go. All you have to do is separate each association by a dot (.).
Keep in mind that this is just an example to help illustrate the usage of Nested includes. In reality, deep relationships like that are few and far between. Currently we don't have many (if any) Tags associated to Images but hopefully this example will help you grasp the concept.
Collection or Entities