KNN3 GraphQL API Quick Start
KNN3 Graph-MW: KNN3 Graph for Metaverse&Web3 theme

Introduction

KNN3 Network is a graph data solution for web3 relational data exploring, similar to many web3 data solutions such as TheGraph, KNN3 provides GraphQL API for web3 developers to access seamlessly.
If you are a Web3 d/App builder or a web3-native data analyst, KNN3 graph is something you should look into. KNN3 graph contains plenty of relational data among users, assets & communities, these relationships are fully backed by web3 users' live on-chain activities.

Start with your first query

(*Notice: your address must be in lower case, or you can not get the correct result.)
A sample query to explore NFTs held by a given address.
Sample code
query {
addrs(where:{address:"0xae89ad222e67205e8d947f131fdc9fa139828745"}) {
address
holdNfts {
contract
imageUrl
symbol
}
}
}
The following result only shows a fragment of NFTs. To see the complete data result, you can visit the link above and try it yourself.
{
"data": {
"addrs": [
{
"address": "0xae89ad222e67205e8d947f131fdc9fa139828745",
"holdnfts": [
{
"contract": "0x5c400511fb292a50b4d81e601815f617db804302",
"imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0x5c400511fb292a50b4D81e601815f617DB804302/logo.gif",
"symbol": "SFGG"
},
{
"contract": "0xc7bda35c92aabcc129379d18024a32f6bae5faca",
"imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0xc7Bda35c92aabcC129379d18024A32F6bAE5FaCA/logo.gif",
"symbol": "GAME"
},
{
"contract": "0xafc156b83295aa31ad7ac420b5ab0aa2ac39741c",
"imageUrl": "https://knn3-static-logo.s3.us-west-1.amazonaws.com/contract/0xaFc156B83295Aa31Ad7AC420B5AB0AA2ac39741c/logo.gif",
"symbol": "DOGGY"
},
...
]
}
]
}
}
​

Limit

For a better user experience, there is a limit=10 for each query by default. You can modify this parameter to a maximum of 30 items for each query.
​
Pagination
Like most GraphQL queries, you can specify pagination queries through the options parameter:
query {
addrs(options:{limit:30,offset:30}){
address
ens
}
}
​

Aggregate Query

You can use aggregate queries in the form of xxxAggregate to obtain the likes of count data. See below for an example where the total number of addresses is queried.
query {
addrsAggregate{
count
}
}
​
Last modified 22d ago
Copy link
On this page
Introduction
Start with your first query
Limit
Aggregate Query