Query for a token or a list of tokens (in case of duplicated symbols) https://api.mochi.pod.town/api/v1/defi/coins?query=sol The response will look something like this
data will be an empty list if the token is not found After that, you can grab the token's id and call the next api https://api.mochi.pod.town/api/v1/defi/coins/{id}, response will be something like this
Additionally, you can also query chart data for a pair of tokens https://api.mochi.pod.town/api/v1/defi/coins/compare?base=ethereum&target=tether&interval=30base and target is the token's id as mentioned above interval is measured in days all query params are required
GET view a user's watchlist data https://api.mochi.pod.town/api/v1/defi/watchlist?user_id={id}user_id is the discord's user id POST add a token to user's watchlist https://api.mochi.pod.town/api/v1/defi/watchlist
{
user_id: '...',
symbol: 'ETH'
}
DELETE remove a token from user's watchlist https://api.mochi.pod.town/api/v1/defi/watchlist?symbol=ETH&user_id=...
query_address: boolean - use when you want to query using the collection's address instead of the symbol
the above endpoint will return either
empty - no record found
response with data (in case there is only one matching symbol of a collection in database)
empty but suggestions field are populated (in case there are multiple collections that match the symbol)
response will have the following shape (some properties are omitted for the sake of brevity) https://api.mochi.pod.town/api/v1/nfts/NEKO/1
{
"data": {
"image_content_type": "",
"rarity_rank": 0,
"rarity_tier": "",
"attributes": null,
"rarity": null,
"metadata_id": "",
"owner": {
"owner_address": "",
"collection_address": "",
"token_id": ""
},
"marketplace": null
},
// where there are mutliple collections with the same symbol (NEKO in this case)
"suggestions": [
{
"name": "Cyber Neko",
"symbol": "NEKO",
"address": "0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73",
"chain": "ftm",
"chain_id": 0
},
{
"name": "Sipher NEKO",
"symbol": "NEKO",
"address": "0x09E0dF4aE51111CA27d6B85708CFB3f1F7cAE982",
"chain": "eth",
"chain_id": 0
},
...
]
}
When you receive this type of response, generally we recommend that you show the selection to user and let them choose, after which you will obtain the collection's address. Let's say they chose the first one (0x7aCeE5D0acC520faB33b3Ea25D4FEEF1FfebDE73)
You can then proceed to call the above api again, this time substituting the symbol with address and add the query_address=true to query string, response will look like following: