RWS Logo
Show / Hide Table of Contents

Webhooks

List webhooks

Example Request:

curl "https://controller-host:8001/api/v2/webhooks" \
	-X GET \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

{
    "webhooks": [
        {
            "uuid": "febdcc87-3454-467c-82b3-cfee4c4524c0",
            "url": "https://my-webhook-server:8443",
            "description": "Webhook for translations",
            "username": "jsmith@example.com",
            "events": [
                "translation.created",
                "translation.statusChanged"
            ]
        }
    ],
    "page": 1,
    "perPage": 25,
    "totalPages": 1,
    "totalItems": 1
}

Return a list of all webhooks.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

GET /api/v2/webhooks

Request Parameters

These parameters should be added to the URL as a query string.
Name Type Description Default Value
url (optional) string URL substring to filter by
description (optional) string description substring to filter by
events (optional) string Show only webhooks with the given comma-separated events. (see table of possible events)
page (optional) int Page number to return 1
perPage (optional) int Number of webhooks to return per page 25

Returns

Returns a list of webhooks as a Webhook object with the following attributes.

Name Type Description
webhooks array of objects List of webhooks as an array of Webhook objects
page int Page number returned
perPage int Number of webhooks returned per page
totalPages int Total number of pages available
totalItems int Total number of webhooks

Webhook Event Types

There are multiple webhook event types. They are as follows:

Type Description
translation.created A translation was created
translation.statusChanged A translation's status has changed
adaptedlp.created An adapted language pair was created
adaptedlp.statusChanged An adapted language pair's status has changed

Create a webhook

Example Request:

curl "https://controller-host:8001/api/v2/webhooks" \
	-X POST \
	-u u_jsmith@example.com_u0VmztKJrwqf: \
	--data-urlencode description="Webhook for translations" \
	--data-urlencode events="translation.created,translation.statusChanged" \
	--data-urlencode url="https://my-webhook-server:8443"

Example Response:

{
    "uuid": "febdcc87-3454-467c-82b3-cfee4c4524c0",
    "url": "https://my-webhook-server:8443",
    "description": "Webhook for translations",
    "username": "jsmith@example.com",
    "events": [
        "translation.created",
        "translation.statusChanged"
    ]
}

Create a webhook.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

POST /api/v2/webhooks

Request Parameters

Name Type Description Default Value
url string URL to post events to
events string List of events that trigger the webhook
description (optional) string Description of the webhook

Returns

Returns the created Webhook object with the following attributes:

Name Type Description
uuid int Identifier of webhook
url string URL to post events to
events array of strings List of events that trigger the webhook
description string Description of the webhook

Update a webhook

Example Request:

curl "https://controller-host:8001/api/v2/webhooks/febdcc87-3454-467c-82b3-cfee4c4524c0" \
	-X PUT \
	-u u_jsmith@example.com_u0VmztKJrwqf: \
	--data-urlencode description="Webhook for translations" \
	--data-urlencode events="translation.created,translation.statusChanged" \
	--data-urlencode url="https://my-webhook-server:8443"

Example Response:

{
    "uuid": "febdcc87-3454-467c-82b3-cfee4c4524c0",
    "url": "https://my-webhook-server:8443",
    "description": "Webhook for translations",
    "username": "jsmith@example.com",
    "events": [
        "translation.created",
        "translation.statusChanged"
    ]
}

Update a webhook's details.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

PUT /api/v2/webhooks/{uuid}

Path Parameters

Name Type Description
uuid string Identifier of the webhook

Request Parameters

Name Type Description Default Value
url string URL to post events to
events string List of events that trigger the webhook
description (optional) string Description of the webhook

Returns

Returns the updated Webhook object.

Retrieve a webhook

Example Request:

curl "https://controller-host:8001/api/v2/webhooks/febdcc87-3454-467c-82b3-cfee4c4524c0" \
	-X GET \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

{
    "uuid": "febdcc87-3454-467c-82b3-cfee4c4524c0",
    "url": "https://my-webhook-server:8443",
    "description": "Webhook for translations",
    "username": "jsmith@example.com",
    "events": [
        "translation.created",
        "translation.statusChanged"
    ]
}

Retrieve a webhook's details.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

GET /api/v2/webhooks/{uuid}

Path Parameters

Name Type Description
uuid string Identifier of the webhook

Returns

Returns the retrieved Webhook object.

Delete a webhook

Example Request:

curl "https://controller-host:8001/api/v2/webhooks/febdcc87-3454-467c-82b3-cfee4c4524c0" \
	-X DELETE \
	-u u_jsmith@example.com_u0VmztKJrwqf:

Example Response:

{
    "uuid": "febdcc87-3454-467c-82b3-cfee4c4524c0",
    "url": "https://my-webhook-server:8443",
    "description": "Webhook for translations",
    "username": "jsmith@example.com",
    "events": [
        "translation.created",
        "translation.statusChanged"
    ]
}

Delete a webhook.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

DELETE /api/v2/webhooks/{uuid}

Path Parameters

Name Type Description
uuid string Identifier of the webhook

Returns

Returns the deleted Webhook object.

Test webhook details

Example Request:

curl "https://controller-host:8001/api/v2/webhooks/test" \
	-X PUT \
	-u u_jsmith@example.com_u0VmztKJrwqf: \
	-d event="translation.created" \
	--data-urlencode url="https://my-webhook-server:8443"

Example Response:

{
    "success": true
}

Send an HTTP Post call to the specified URL, mimicking a webhook triggering for the given event.

This endpoint is restricted to the following roles: admin, super admin

HTTP Request

PUT /api/v2/webhooks/test

Request Parameters

Name Type Description Default Value
url string URL to post events to
event (optional) string Event that triggers the webhook sampleEvent

Returns

Returns the result of the webhook test as a TestResult object.

Name Type Description
success boolean Whether or not the test was successful
In this page
Back to top