Skip to content

Commit 996ae98

Browse files
idalithbbenface
andauthored
Querying Best Practices (#796)
* Update website/pages/en/querying/querying-best-practices.mdx --------- Co-authored-by: Benoît Rouleau <[email protected]>
1 parent b22ab57 commit 996ae98

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

website/pages/en/querying/querying-best-practices.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: Querying Best Practices
33
---
44

5-
The Graph provides a decentralized way to query data from blockchains via GraphQL APIs, making it easier to query data with the GraphQL language.
5+
The Graph provides a decentralized way to query data from blockchains. Its data is exposed through a GraphQL API, making it easier to query with the GraphQL language.
66

7-
Learn the essential GraphQL language rules and GraphQL querying best practices.
7+
Learn the essential GraphQL language rules and best practices to optimize your subgraph.
88

99
---
1010

1111
## Querying a GraphQL API
1212

13-
### The anatomy of a GraphQL query
13+
### The Anatomy of a GraphQL Query
1414

1515
Unlike REST API, a GraphQL API is built upon a Schema that defines which queries can be performed.
1616

@@ -50,7 +50,7 @@ query [operationName]([variableName]: [variableType]) {
5050
}
5151
```
5252

53-
While the list of syntactic do's and don'ts is long, here are the essential rules to keep in mind when it comes to writing GraphQL queries:
53+
## Rules for Writing GraphQL Queries
5454

5555
- Each `queryName` must only be used once per operation.
5656
- Each `field` must be used only once in a selection (we cannot query `id` twice under `token`)
@@ -59,17 +59,17 @@ While the list of syntactic do's and don'ts is long, here are the essential rule
5959
- In a given list of variables, each of them must be unique.
6060
- All defined variables must be used.
6161

62-
Failing to follow the above rules will end with an error from the Graph API.
62+
> Note: Failing to follow these rules will result in an error from The Graph API.
6363
64-
For a complete list of rules with code examples, please look at our [GraphQL Validations guide](/release-notes/graphql-validations-migration-guide/).
64+
For a complete list of rules with code examples, check out [GraphQL Validations guide](/release-notes/graphql-validations-migration-guide/).
6565

6666
### Sending a query to a GraphQL API
6767

6868
GraphQL is a language and set of conventions that transport over HTTP.
6969

7070
It means that you can query a GraphQL API using standard `fetch` (natively or via `@whatwg-node/fetch` or `isomorphic-fetch`).
7171

72-
However, as stated in ["Querying from an Application"](/querying/querying-from-an-application), it's recommend to use `graph-client` which supports unique features such as:
72+
However, as mentioned in ["Querying from an Application"](/querying/querying-from-an-application), it's recommended to use `graph-client`, which supports the following unique features:
7373

7474
- Cross-chain Subgraph Handling: Querying from multiple subgraphs in a single query
7575
- [Automatic Block Tracking](https://github.com/graphprotocol/graph-client/blob/main/packages/block-tracking/README.md)

0 commit comments

Comments
 (0)