🔍Perform Query
Last updated
Last updated
After deploying your subgraph, you can easily access and query it via GraphQL playground for query. You can open the "GraphQL API" link in your dashboard to access your data
For example, you may access the publicly available Mantle token approval subgraph at https://subgraph-api.mantle.xyz/api/public/3711e6ce-3600-49ef-9732-08a2a1b93ac6/subgraphs/test_org/token-approval/-/gn
To get to know the sync status directly inside the subgraph, a user may run the following query by using _meta
:
The result would be similar to the following:
Subgraphs expose Mantle blockchain data via a GraphQL API, making it easy for anyone familiar with the GraphQL language to get started. A GraphQL API differs from traditional REST APIs in that it relies on a schema definition to outline the available queries, mutations, and data types that clients can access. This schema-driven approach enables clients to precisely specify the data they need, eliminating the need to over-fetch data. Here's why this is beneficial:
Precision: GraphQL clients can tailor their queries to retrieve only the data they require, enhancing efficiency.
Flexibility: Clients can request related data in a single query, reducing the number of API calls needed.
Predictability: The schema provides clear documentation for available data and operations.
GraphQL Syntax
GraphQL queries are composed using a specific syntax that allows for hierarchical data retrieval. Clients specify the fields they want to retrieve and their relationships within a single query. This approach minimizes unnecessary data retrieval, resulting in more concise and efficient requests.
Best Practices for GraphQL with Mantle Subgraph
When working with the Mantle Subgraphs, it's essential to follow best practices to ensure optimal performance and efficiency. These best practices are outlined in official Graph Protocol documentation.
For detailed instructions on querying Mantle Subgraphs using GraphQL and to ensure adherence to best practices, refer to the official documentation and guidelines provided by the Mantle and Graph Protocol teams. These resources offer valuable insights and recommendations to streamline your interaction with blockchain data through GraphQL. https://thegraph.com/docs/en/querying/querying-best-practices/