Blockchain Data APIs - Polling
Immutable's Blockchain Data APIs index on-chain state changes and off-chain metadata to allow developers to efficiently retrieve information from Immutable's rollups.
What is polling?
API polling, often referred to simply as "polling," is a common method used to retrieve data from a remote server or service. It involves making periodic requests to an API or via an SDK to check for updates or new information. Polling is useful for scenarios where real-time data updates are not critical, and it's acceptable to have a slight delay between data changes and when they are reflected in the client application. However, it can be less efficient and consume more resources compared to other methods like webhooks.
Webhooks, on the other hand, provide a more efficient and real-time way of receiving updates from a server or service. Instead of repeatedly polling for updates, the server sends data to the client as soon as an event or change occurs, reducing the need for constant requests.
What can polling be used for?
In Web3 gaming, polling can be used for the following scenarios:
Ad-hoc Player Driven Requests: Polling is commonly used to provide users with more information regarding a specific asset or activity. When a player expresses interest in a particular asset or activity, polling allows the application to fetch and display the most current and relevant information to the player. This ensures that users have access to up-to-date details about the assets they're interested in, enhancing their overall experience and engagement with the application.
Regular Data Synchronisation: Polling is commonly used to keep a local database or cache in sync with a remote server's data. This is valuable for applications that rely on up-to-date data but can tolerate some delay. Immutable strongly recommends a webhooks implementation if data synchronisation is required by your application.
Low Data Volume: When the amount of data being checked for updates is relatively small, polling can be efficient and straightforward. Frequent polling may not strain resources significantly.
Resource-Limited Environments : In resource-constrained environments periodic polling may be a more practical choice than handling incoming webhooks.
Simple Implementation: Polling is relatively simple to implement in client applications. It doesn't require complex event handling or server setup like webhooks do.
Error Handling: Polling allows for easier error handling. If a request fails, the client can retry without losing the entire state.
How to setup webhooks?
Follow our setup guide how to set up webhooks for your application
Features
Feature | Use-cases |
---|---|
Get data on activities | This feature will return a list of activities associated with a chain, collection or individual NFT. Adjust the activityType variable to filter by activity. You can get a list of activities, or details of a single activity using this function. |
Get data on chains | This feature returns a list of supported blockchains. This function is useful to get details on supported chains without need for hard coding them, and programs can use it to integrate new chains automatically. |
Get data on collections | This feature is useful for getting information on a single collection to review details such as its metadata, or a list of collections deployed on a blockchain. |
Get data on NFTs | This feature is useful for getting information on a single NFT to review details such as its metadata, or a list of NFT that belong to a collection. |
Get data on Minting API requests | This feature is utilised to determine the status and token_id of mint requests executed through the Minting API. |
Get data on tokens | This feature returns a list of supported ERC20 tokens supported on a blockchain. It will also provide additional details of an individual ERC20 smart contract. |
BaseURL details
Immutable's BaseURL
is the root part of each API endpoint URL. It is used for all API calls.
Below is the supported list for each environment:
Environment | BaseURL |
---|---|
Testnet | https://api.sandbox.immutable.com |
Mainnet | https://api.immutable.com |