To integrate the Kenshi Reverse-API service into your ecosystem or workflow, you need to expose an HTTP POST endpoint that is publicly available over the internet. Once ready, you need to define an event listener task, so the Kenshi dispatcher can find relevant events for you and notify your endpoint whenever it finds them. Creating a task and registering your endpoint can be done using the Kenshi dashboard .
To register a new Reverse-API endpoint you'll need to fill and submit the New Reverse-API form. You can use the following list as a guide for each of the fields in this form.
- Endpoint : Your Reverse-API endpoint. This endpoint needs to be accessible over the internet. This endpoint should accept post requests and return a "200" success code on successful receiving of the events.
- Chain : The blockchain you are interested in. This is a part of the query that will run against the Kenshi blockchain data clusters. This field cannot be modified later.
- Starting block : From which block should we start informing you of the events? You can choose a block number in the past if you're looking for historical data. This field cannot be modified later.
- Sync task ID : A Sync task ID is needed to determine the last synced block matching the query of your Reverse-API task.
- Duration : For how many months should this task run?
- Requests : Amount of request credits you need for this endpoint. Each time a request is made to your endpoint one request credit is charged.
- Query : Define a query for this Reverse-API. Here you need to add contract addresses, event signatures, event names or any other required info for querying the events from the Kenshi blockchain data clusters. The Kenshi event Dispatcher uses this query against the data cluster on each run, then sends every matched record to your Reverse-API endpoint in a separate request.