Can limit
be used inside of Include
when using the backend API?
#413
-
When using include in a call to the backend-api, can I use limit the results of that call? Example:
Can I limit this to just 1 cart? Thanks! —Asked this in comments of another thread but deleted and moved to here |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use a URL like “/carts/:last” to have it return a single record as the result The “:last” segment refers to the latest record depending on how the collection is sorted, and by default it’s sorted by date, hence it refers to the latest cart Alternatively you can add “limit: 1” to the data object, it then it would return a paginated result, so I imagine you would prefer the former approach |
Beta Was this translation helpful? Give feedback.
You can use a URL like “/carts/:last” to have it return a single record as the result
The “:last” segment refers to the latest record depending on how the collection is sorted, and by default it’s sorted by date, hence it refers to the latest cart
Alternatively you can add “limit: 1” to the data object, it then it would return a paginated result, so I imagine you would prefer the former approach