Webhooks

It is possible to register a webhook that will be called whenever a content request is modified. You can set the webhook from the Customer Portal and via the API. The webhook will be invoked with a PUT request containing a JSON body, see below for the format.

Info

When using a test token the webhook will be called two times:

  • When the request is submitted
  • When test data is generated about 10 seconds later

Webhook format for Content Requests

{
    "type": "content-request",
    "request": {
        "id": "generated-unique-id",
        "state": "complete",
        "created": "2016-02-23T09:02:08.22Z",
        "completed": "2016-02-26T11:05:43.40Z",
        "language": {
            "source": "sv",
            "target": "en"
        },
        "fields": [
            {
                "id": "body",
                "type": "localizable",
                "data": "html",
                "value": "<p>This text can contain <strong>HTML tags</strong></p>",
                "originalValue": "<p>Denna text kan innehålla <strong>HTML taggar</strong></p>"
            }
        ]
    }
}

Update the webhook

Webhooks can be set via the Customer portal but can also be updated via the API.

PUT /v1/webhook
Headers
Authorization: Bearer your-token-here
Content-Type: application/json
Body
{
    "url": "http://example.com/webhook"
}
Response 200 OK
{
    "url": "http://example.com/webhook"
}
Response 400 Bad Request

If the URL is invalid.

{
    "state": "invalid",
    "errors": [
        "..."
    ]
}
Response 403 Forbidden

If no authorization header is sent or if the header is not on the form Bearer your-token-here or if the token is invalid.

Get the current webhook

Webhooks can be set via the Customer portal but can also be updated via the API.

GET /v1/webhook
Headers
Authorization: Bearer your-token-here
Response 200 OK
{
    "url": "http://example.com/webhook"
}
Response 403 Forbidden

If no authorization header is sent or if the header is not on the form Bearer your-token-here or if the token is invalid.

results matching ""

    No results matching ""