Overview
While getting familiar with , you want to extend API functionality. StackOne API allows joining data from different objects into one combined response. The StackOne implementation adds advanced ,include or expand, to obtain the required information.
Example scenario
Let’s imagine an example:-
You’ve acquired a list of your available Accounts integrations (account
id) -
Then you’ve retrieved a list of employees for a specific
x-account-idand selected one particular employee by specifying the resourceidin the path - Next you want to get all available information of that employee
avatar_url or additional information about the work_location and employment. This is where the include and expand parameters become handy.
Including optional params
include and expand reserved keywords allow retrieving additional information about the employee. As an example, the usage of include=avatar_url and expand=work_location returns a link to the employee’s avatar and details of work location.
Include
Include is meant to return additional fields not included by default for privacy or performance reasons. For example, the avatar_url field may require the hosting of the underlying image, which can slow down the response unnecessarily if you do not need it.
Expand
Expand, on the other hand, is used to expand objects (also called models) for which only the ID would otherwise be given and would therefore require a call to another resource to retrieve the underlying data (such as an employee’s employment or work location details )
