Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add breadcrumb info
  • Loading branch information
keharper committed Aug 17, 2018
commit 2bb5798d5da92c947e50347afca141ad6b1709ef
4 changes: 4 additions & 0 deletions guides/v2.3/graphql/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ GraphiQL is an in-browser tool for writing, validating, and testing GraphQL quer
![GraphiQL browser]({{ page.baseurl }}/graphql/images/graphql-browser.png)

To begin using GraphiQL, set the GraphQL endpoint by entering `http://<magento2-3-server>/graphql` in the URL bar, then click **Set endpoint**. You can use the browser in the right column to determine how to set up a query. Additional examples are also available at [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html).


{:.bs-callout .bs-callout-info}
You can access the GraphQL introspection feature only if your Magento instance is in developer mode. See [Set the Magento mode]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-mode.html) for more information about modes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider leaving off "for more information about modes" -- just

"See [Set the Magento mode]."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's too terse for me. Changed to

[Set the Magento mode] describes how to check and change the mode.

66 changes: 42 additions & 24 deletions guides/v2.3/graphql/reference/categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: category endpoint
version: 2.3
---

The `category` endpoint allows you to search for a single category definition or the entire category tree.
The `category` endpoint allows you to search for a single category definition or the entire category tree. To return multiple category levels in a single call, define the response so that it contains up to ten nested `children` options. You cannot return the entire category tree if it contains more than 10 sublevels.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, nesting level limit can be re-configured via di.xml by the system integrator.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it helps, but consider adding a "for example"

define a response so that it contains up to ten nested children options, for example the query can return a CategoryTree object with up to ten levels of categories, and each of those categories can contain up to ten CategoryTree objects with up to ten subcategories.

Also, in the Sample Queries section -- It might be good to show a real response for the CategoryTree query since it's kind of complicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the description as is, but added sample output.

## Query structure

``` json
```
category (
id: int
): CategoryTree
Expand Down Expand Up @@ -40,17 +40,19 @@ Attribute | Data type | Description
`product_count`| Int | The number of products in the category
`default_sort_by`| String | The attribute to use for sorting
`products(<attributes>)` | `CategoryProducts` | The list of products assigned to the category
`children` | `CategoryTree` |
`breadcrumbs` | `Breadcrumb` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breadcrumb description missing because it's obvious, right?

Further down page: Breadcrumb object --- Make Breadcrumb link to the Breadcrumb object

or in description: A Breadcrumb object that contains a set of links to show customers where they are in relation to other ....

`children` | `CategoryTree` | A `CategoryTree` object that contains information about a child category. You can specify up to 10 levels of child categories.


#### CategoryProducts object

The `products` attribute can contain the following attributes:

Attribute | Data type | Description
--- | --- | ---
`pageSize` | Int | Specifies the maximum number of results to return at once. This attribute is optional. The default value is 20.
`currentPage` | Int | Specifies which page of results to return. The default value is 1.
`sort` | `ProductSortInput` Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information.

#### CategoryProducts
`sort` | `ProductSortInput` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider dropping "for more information"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to [Searches and pagination in GraphQL] describes sort orders.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the way you changed the "See" reference 🥇

The `CategoryProducts` object contains the following attributes:

Expand All @@ -61,28 +63,24 @@ Attribute | Data type | Description
`total_count` | Int | The number of products returned


The response can contain up to ten nested `children` options that allow you to return multiple levels of the category tree. In most cases, the entire category tree can be returned in a single call. The following response definition returns two levels of categories:
#### Breadcrumb object

{% highlight json %}
{
category_tree {
id
level
name
children {
id
level
name
}
}
}
{% endhighlight %}
A breadcrumb trail is a set of links that shows customers where they are in relation to other pages in the
store.

Attribute | Data type | Description
--- | --- | ---
`category_id` | Int | An ID that uniquely identifies the category
`category_name` | String | The display name of the category
`category_level` | Int | Indicates the depth of the category within the tree
`category_url_key` | String | The url key assigned to the category

## Sample Query

## Sample Queries

The following query returns information about category ID `20` and four levels of subcategories. In the sample data, category ID `20` is assigned to the "Women" category.

{% highlight json %}
```
{
category(id: 20) {
products {
Expand Down Expand Up @@ -119,4 +117,24 @@ The following query returns information about category ID `20` and four levels o
}
}
}
{% endhighlight %}
```

The following query returns breadcrumb information about the women's tops category (`id` = 25).

```
{
category (
id: 25
) {
id
level
name
breadcrumbs {
category_id
category_name
category_level
category_url_key
}
}
}
```