Authentication

In order to communicate with the Webhooks API you will need to provide the token you configured on your node through the Authorization header. Authenticating with an invalid token will return 401 Unauthorized.

Headers

NameTypeDescriptionRequired
AuthorizationstringThe webhook token defined in the node configuration.

List all webhooks

Endpoint

GET /api/webhooks

Query Parameters

NameTypeDescriptionRequired
pageintThe number of the page that will be returned.
limitintThe number of resources per page.

Response

{
    "meta": {
        "count": 29,
        "pageCount": 1,
        "totalCount": 29,
        "next": null,
        "previous": null,
        "self": "/api/v2/webhooks?page=1&limit=100",
        "first": "/api/v2/webhooks?page=1&limit=100",
        "last": "/api/v2/webhooks?page=1&limit=100"
    },
    "data": [
        {
            "id": 1,
            "event": "block.forged",
            "target": "https://httpbin.org/post",
            "enabled": true,
            "conditions": [
                {
                    "key": "generatorPublicKey",
                    "condition": "eq",
                    "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
                }
            ]
        }
    ]
}

Retrieve a webhook

Endpoint

GET /api/webhooks/{id}

Path Parameters

NameTypeDescriptionRequired
idstringThe identifier of the webhook to be retrieved.

Response

{
    "data": {
        "id": 1,
        "event": "block.forged",
        "target": "https://httpbin.org/post",
        "enabled": true,
        "conditions": [
            {
                "key": "generatorPublicKey",
                "condition": "eq",
                "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
            }
        ]
    }
}

Create a webhook

Endpoint

POST /api/webhooks

Body Parameters

NameTypeDescriptionRequired
eventstringThe name of the event to be listened for.
targetstringThe target url for the HTTP payload.
enabledstringThe value to enable or disable the webhook.
conditionsarrayThe list of conditions required to trigger the webhook.

Response

{
    "data": {
        "id": 1,
        "event": "block.forged",
        "target": "https://httpbin.org/post",
        "token": "7e66949f67b36c34a05eeb3a866957b3f1b6f8947fb215500b78e5091d4e484a",
        "enabled": true,
        "conditions": [
            {
                "key": "generatorPublicKey",
                "condition": "eq",
                "value": "032fcfd19f0e095bf46bd3ada87e283720c405249b1be1a70bad1d5f20095a8515"
            }
        ]
    }
}

Update a webhook

Endpoint

PUT /api/webhooks/{id}

Path Parameters

NameTypeDescriptionRequired
idstringThe identifier of the webhook to be updated.

Query Parameters

NameTypeDescriptionRequired
eventstringThe name of the event to be listened for.
targetstringThe target url for the HTTP payload.
enabledstringThe value to enable or disable the webhook.
conditionsarrayThe list of conditions required to trigger the webhook.

Response

{}

Delete a webhook

Endpoint

DELETE /api/webhooks/{id}

Path Parameters

NameTypeDescriptionRequired
idstringThe identifier of the webhook to be deleted.

Response

{}
Last Updated: 8/24/2018, 6:39:53 AM