How to Invoke APIs of KS Query
The KS Query API provides a suite of endpoints to interact with blockchain data, such as retrieving smart contract details, transactions, and block information. Below is a step-by-step guide to invoking these APIs effectively.
Step 1: Copy the Desired Endpoint
- Open the All APIs section in the KS Query Console.
-
Locate the specific endpoint you want to use. For instance:
https://dev-ks-analytics-api.p2eppl.com/analytics/chaincode
-
Click on the copy icon next to the endpoint to copy its URL.
Step 2: Check Parameters
- Click the Check Params button next to the endpoint you selected.
- Gather the required details:
- Params: Retrieve the headers and query parameters related with API
- Blockchain: Retrieve the blockchain name from the Blockchain & Network tab (e.g., Ethereum or Kalp).
- Network: Retrieve the network name from the same tab (e.g.,
devnet
). -
API Key: Select an active API key from the API Key Generation tab.
-
Optionally, explore and configure Search Parameters:
smartContractName
: The name of the smart contract to filter the results (optional).from
andto
: formatted start and end dates for filtering (optional).
Step 3: Use the Endpoint in Postman
- Open Postman and create a new GET request.
- Paste the copied endpoint URL into the request URL field.
- Add the required Headers to the request:
network
: Specify the network name (e.g.,devnet
).blockchain
: Specify the blockchain name (e.g.,kalp
).api-key
: Provide the active API key retrieved from the KS Query console.
Example Header Configuration:
Key | Value |
---|---|
network |
devnet |
blockchain |
kalp |
api-key |
your-api-key |
- Click Send in Postman to execute the API request and receive the response.
Conclusion
Using the KS Query APIs process that allows you to harness blockchain data for your applications. By carefully setting up your API requests in tools like Postman, you can seamlessly integrate these APIs into your workflows. Follow these steps to fetch data dynamically and build powerful blockchain-based solutions.