chore(docs): Generated API Reference (#3826)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
69bea8cc13
commit
ab22b345eb
File diff suppressed because one or more lines are too long
@@ -406,6 +406,41 @@ info:
|
||||
|
||||
For example, if the `count` is 100 and the `limit` is 50, you can divide the
|
||||
`count` by the `limit` to get the number of pages: `100/50 = 2 pages`.
|
||||
|
||||
|
||||
### Sort Order
|
||||
|
||||
|
||||
The `order` field available on endpoints supporting pagination allows you to
|
||||
sort the retrieved items by an attribute of that item. For example, you can
|
||||
sort products by their `created_at` attribute by setting `order` to
|
||||
`created_at`:
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
curl "http://localhost:9000/admin/products?order=created_at" \
|
||||
|
||||
-H 'Authorization: Bearer {api_token}'
|
||||
|
||||
```
|
||||
|
||||
|
||||
By default, the sort direction will be ascending. To change it to
|
||||
descending, pass a dash (`-`) before the attribute name. For example:
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
curl "http://localhost:9000/admin/products?order=-created_at" \
|
||||
|
||||
-H 'Authorization: Bearer {api_token}'
|
||||
|
||||
```
|
||||
|
||||
|
||||
This sorts the products by their `created_at` attribute in the descending
|
||||
order.
|
||||
license:
|
||||
name: MIT
|
||||
url: https://github.com/medusajs/medusa/blob/master/LICENSE
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -373,6 +373,37 @@ info:
|
||||
|
||||
For example, if the `count` is 100 and the `limit` is 50, you can divide the
|
||||
`count` by the `limit` to get the number of pages: `100/50 = 2 pages`.
|
||||
|
||||
|
||||
### Sort Order
|
||||
|
||||
|
||||
The `order` field available on endpoints supporting pagination allows you to
|
||||
sort the retrieved items by an attribute of that item. For example, you can
|
||||
sort products by their `created_at` attribute by setting `order` to
|
||||
`created_at`:
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
curl "http://localhost:9000/list/products?order=created_at"
|
||||
|
||||
```
|
||||
|
||||
|
||||
By default, the sort direction will be ascending. To change it to
|
||||
descending, pass a dash (`-`) before the attribute name. For example:
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
curl "http://localhost:9000/list/products?order=-created_at"
|
||||
|
||||
```
|
||||
|
||||
|
||||
This sorts the products by their `created_at` attribute in the descending
|
||||
order.
|
||||
license:
|
||||
name: MIT
|
||||
url: https://github.com/medusajs/medusa/blob/master/LICENSE
|
||||
|
||||
Reference in New Issue
Block a user