Query an existing Subgraph and check how recently its data was indexed. This example reads the
five largest pools by total value locked from a Uniswap-style schema and includes _meta for
indexing information.
Expected result: five pools and the indexed block in _meta. Your endpoint can return
different pools and values as indexing advances.
Use a deployment that exposes pools, token0, token1, and totalValueLockedUSD, or adapt the
query to your Subgraph's schema. Replace
<UNISWAP_DEPLOYMENT_CID> with its Deployment CID, not a Graph Network Subgraph ID.
Prerequisites
- A GraphOps Platform account.
- An organization with access to Subgraphs.
- An Owner or Developer role to create an API key that includes Subgraphs, or such a key supplied by your team.
- A public Deployment CID for a Subgraph with the fields used in this example.
Create an API key
Create API key(opens in a new tab)Choose your organization, create a query key that includes Subgraphs, and store the plaintext value in your secret manager.
Choose the deployment
Use the Deployment CID published by the Subgraph owner or returned by your Graph CLI deployment. To find a public dataset and its current Deployment CID, search Discover Subgraphs. The deployment endpoint stays on that version even if the owner publishes an upgrade.
The separate subgraphId endpoint follows the owner's upgrades, but moves to each new version
before it is indexed. Before you build on either one, see
Choose your Subgraph setup.
Query the deployment
Run a GraphQL query against the Deployment CID endpoint.
Prerequisites
Set GRAPHOPS_API_KEY to your GraphOps API key.
Replace
<UNISWAP_DEPLOYMENT_CID>with the Deployment CID of a Uniswap-style Subgraph.
CLI · curl
curl --fail-with-body --silent --show-error "https://subgraphs.graphops.xyz/v1/deploymentCID/<UNISWAP_DEPLOYMENT_CID>" \
-H "Authorization: Bearer ${GRAPHOPS_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"query": "query TopPools { pools(first: 5, orderBy: totalValueLockedUSD, orderDirection: desc) { id token0 { symbol } token1 { symbol } totalValueLockedUSD } _meta { block { number hash } hasIndexingErrors } }"
}'
Output
{ "data": { "pools": [The entities your query selected { "id": "0x277667eb3e34f134adf870be9550e9f323d0dc24", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-cvxsteCRV" }, "totalValueLockedUSD": "1110167010695.785900004139211677005" }, { "id": "0x8c0411f2ad5470a66cb2e9c64536cfb8dcd54d51", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-yvCurve-IronBank" }, "totalValueLockedUSD": "1432077483.208630196467118329099649" }, { "id": "0x055284a4ca6532ecc219ac06b577d540c686669d", "token0": { "symbol": "ease.org" }, "token1": { "symbol": "ez-SLP-WBTC-WETH" }, "totalValueLockedUSD": "1322031013.848042060988788389158996" }, { "id": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640", "token0": { "symbol": "USDC" }, "token1": { "symbol": "WETH" }, "totalValueLockedUSD": "385191775.1218005724860114722196234" }, { "id": "0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8", "token0": { "symbol": "USDC" }, "token1": { "symbol": "WETH" }, "totalValueLockedUSD": "321144439.2777974484977405304295032" } ], "_meta": {Indexing state behind this result "block": { "number": 26285620,Highest indexed block served "hash": "0x7931a9fc337c615e67690a3083685a5680a72653718c13451f7697ea856b14f3" }, "hasIndexingErrors": falseCheck before trusting the data } }}GraphQL reports query problems in an errors array, often with HTTP status 200. If the response
has errors instead of data, compare the field names with the deployment's schema in
Schema reference. For 401 or 404 responses, see
Troubleshooting.
Next steps
Last updated