You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/api/admin-spec3-base.yaml
+178-7
Original file line number
Diff line number
Diff line change
@@ -15,21 +15,185 @@ info:
15
15
16
16
In many endpoints you'll find an `expand` query parameter that can be passed to the endpoint. You can use the `expand` query parameter to unpack an entity's relations and return them in the response.
17
17
18
-
For example, when you list customers you can also retrieve their groups by passing to the `expand` query parameter the value `groups`.
18
+
Please note that the relations you pass to `expand` replace any relations that are expanded by default in the request.
19
19
20
-
You can expand more than one relation by separating the relations in the `expand` query parameter with a comma. For example, to retrieve both the orders and the groups of a customer, pass to the `expand` query parameter the value `groups,orders`.
20
+
### Expanding One Relation
21
21
22
-
Please note that the parameters you pass to `expand` replace any relations that are expanded by default.
22
+
For example, when you retrieve products, you can retrieve their collection by passing to the `expand` query parameter the value `collection`:
This would retrieve each product with only its properties, without any relations like `collection`.
23
52
24
53
## Selecting Fields
25
54
26
55
In many endpoints you'll find a `fields` query parameter that can be passed to the endpoint. You can use the `fields` query parameter to specify which fields in the entity should be returned in the response.
27
56
57
+
Please note that if you pass a `fields` query parameter, only the fields you pass in the value along with the `id` of the entity will be returned in the response.
58
+
59
+
Also, the `fields` query parameter does not affect the expanded relations. You'll have to use the `expand` parameter instead.
60
+
61
+
### Selecting One Field
62
+
63
+
For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing `title` as a value to the `fields` query parameter:
You can pass more than one field by seperating the field names in the `fields` query parameter with a comma.
29
82
30
-
Only the fields you pass to `field` will be retrieved and returned in the response. Any fields that are returned by default will not be returned in this case. This does not affect relations.
83
+
For example, to select the `title` and `handle` of products:
This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman.
109
+
110
+
### Strings
111
+
112
+
You can pass a string value in the form of `<parameter_name>=<value>`.
Each array value must be passed as a separate query parameter in the form `<parameter_name>[]=<value>`. You can also specify the index of each parameter in the brackets `<parameter_name>[0]=<value>`.
Note that the `-g` parameter passed to `curl` disables errors being thrown for using the brackets. Read more [here](https://curl.se/docs/manpage.html#-g).
186
+
187
+
### Object
188
+
189
+
Object parameters must be passed as separate query parameters in the form `<parameter_name>[<key>]=<value>`.
You can use the `offset` query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on.
43
207
208
+
For example, to limit the number of products returned in the List Products endpoint:
In listing fields, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`.
217
+
In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: `count`, `limit`, and `offset`.
47
218
48
-
Similarly to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result.
219
+
Similar to the query parameters, `limit` is the maximum number of items that can be returned in the response, and `field` is the number of items that were skipped before the entities in the result.
49
220
50
221
`count` is the total number of available items of this entity. It can be used to determine how many pages are there.
0 commit comments