Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 23c89ba

Browse files
Update category-list.md (#8313)
* Update category-list.md Give Example of url_key and url_path attribute with categoryList query. * Update category-list.md * Update category-list.md * Update category-list.md Co-authored-by: Kevin Harper <keharper@users.noreply.github.com>
1 parent f0aa0e4 commit 23c89ba

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

src/guides/v2.3/graphql/queries/category-list.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,86 @@ The following query returns breadcrumb information about categories that have th
276276
}
277277
```
278278

279+
### Return the categoryList by url_key filters
280+
281+
The following query returns information about the Gear category using a `url_key` filter. You must pass the `url_key` value without a suffix and specify either the `eq` or `in` keyword.
282+
283+
**Request:**
284+
285+
```graphql
286+
{
287+
categoryList(filters: { url_key: { eq: "gear" } }) {
288+
id
289+
level
290+
name
291+
path
292+
url_path
293+
url_key
294+
children_count
295+
}
296+
}
297+
```
298+
299+
**Response:**
300+
301+
```json
302+
{
303+
"data": {
304+
"categoryList": [
305+
{
306+
"id": 3,
307+
"level": 2,
308+
"name": "Gear",
309+
"path": "1/2/3",
310+
"url_path": "gear",
311+
"url_key": "gear",
312+
"children_count": "3"
313+
}
314+
]
315+
}
316+
}
317+
```
318+
319+
### Return the categoryList by url_path filters
320+
321+
The following query returns information about the Gear > Bags category using the `url_path` filter. Do not specify a suffix in the `url_path` value. The `url_path` filter accepts either the `eq` or `in` keyword.
322+
323+
**Request:**
324+
325+
```graphql
326+
{
327+
categoryList(filters: { url_path: { eq: "gear/bags" } }) {
328+
id
329+
level
330+
name
331+
path
332+
url_path
333+
url_key
334+
children_count
335+
}
336+
}
337+
```
338+
339+
**Response:**
340+
341+
```json
342+
{
343+
"data": {
344+
"categoryList": [
345+
{
346+
"id": 4,
347+
"level": 3,
348+
"name": "Bags",
349+
"path": "1/2/3/4",
350+
"url_path": "gear/bags",
351+
"url_key": "bags",
352+
"children_count": "0"
353+
}
354+
]
355+
}
356+
}
357+
```
358+
279359
## Input attributes
280360

281361
You must specify the `filters` attribute as input to your query.

0 commit comments

Comments
 (0)