docs: add array filter with comma in requests (#11478)

This commit is contained in:
Shahed Nasser
2025-02-14 18:35:03 +02:00
committed by GitHub
parent 03b8bda1ba
commit 16b89f60e0
3 changed files with 9493 additions and 9967 deletions

View File

@@ -661,20 +661,35 @@ curl -g "http://localhost:9000/admin/products?created_at[$lt]=2023-02-17T07:22:3
### Array
Array filters can be passed either as:
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_name>[]=<value1>,<value2>`, separating the values by a comma.
- `<parameter_name>[]=<value1>&<parameter_name>[]=<value2>`, passing each value as a separate query parameter. You can also specify the index of each
parameter in the brackets `<parameter_name>[0]=<value>`.
</DividedMarkdownContent>
<DividedMarkdownCode>
```bash title="Array filter"
<CodeTabs group="array-filter">
<CodeTab label="Comma-separated" value="comma-separated">
```bash
curl -g "http://localhost:9000/admin/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7,sc_234PGVB42PZ7N3YQEP2WDM7PC7" \
-H 'Authorization: Bearer {jwt_token}'
```
</CodeTab>
<CodeTab label="Separate parameters" value="separate-query-parameters">
```bash
curl -g "http://localhost:9000/admin/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7" \
-H 'Authorization: Bearer {jwt_token}'
```
</CodeTab>
</CodeTabs>
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).

View File

@@ -639,19 +639,33 @@ curl -g "http://localhost:9000/store/products?created_at[$lt]=2023-02-17T07:22:3
### Array
Array filters can be passed either as:
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_name>[]=<value1>,<value2>`, separating the values by a comma.
- `<parameter_name>[]=<value1>&<parameter_name>[]=<value2>`, passing each value as a separate query parameter. You can also specify the index of each
parameter in the brackets `<parameter_name>[0]=<value>`.
</DividedMarkdownContent>
<DividedMarkdownCode>
```bash title="Array filter"
<CodeTabs group="array-filter">
<CodeTab label="Comma-separated" value="comma-separated">
```bash
curl -g "http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7,sc_234PGVB42PZ7N3YQEP2WDM7PC7"
```
</CodeTab>
<CodeTab label="Separate parameters" value="separate-query-parameters">
```bash
curl -g "http://localhost:9000/store/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7"
```
</CodeTab>
</CodeTabs>
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).

File diff suppressed because it is too large Load Diff