Quickstart
Quick introduction into the Artion GraphQL API usage.
You can use Artion GraphQL API to watch activity on yours tokens, to browse any tokens you are interested in or to get any other information from Artion.
This quickstart will guide you through first queries to the Artion GraphQL API. In the first example you will obtain status of auction running on given token, in the second example you will browse list of tokens, filtered and sorted by given fields.
Until you want to run you own Artion based marketplace, you don't need to worry about the API server setup - you can use our public API points:
The API allows only to read data aggregated from the chain. If you want to do any operation writing to the chain (create an auction/listing, bid etc.), you will need to sign and send the transaction directly to the Opera RPC, for example using Web3.js library and Metamask.
Example 1: Auction Status
To check status of auction running on token 2937
(0xb79
in hexa) from collection 0x5dbc2a8b01b7e37dfd7850237a3330c9939d6457
, you can just send following GraphQL API query:
You will get result in format defined by the query:
Try the example NOW in the integrated GraphiQL interface: https://artion-api-a.fantom.network/graphi
Tip: The GraphiQL interface allows to browse the API documentation - just click on the "Docs" button in the top right corner of the GraphiQL interface. Also, under the "History" button you can browse your previous queries.
Example 2: Token Listing
To browse list of tokens you can use tokens()
function, which allows to filter, sort and paginate list of all tokens known to Artion.
Following query filters only tokens more expensive than 1 USD, in ascending order, while sorting by creation time and limiting amount of results to five. In other words, it will find 5 oldest tokens above 1 USD.
This will produce output similar to:
For more information about pagination - like how to get following five results - check GraphQL Schema Basics.
Sending the GraphQL request
To send a GraphQL request you can use specialized library like Apollo Client for JavaScript, or Graphene for Python.
However, you can also send the request manually. Check following example to load data from the API using plain JavaScript:
In the json
variable you will get a result object identical with the output from previous example.
Last updated