Skip to content

Hooks Web

Operations Summary

Method Endpoint Description
GET /api/hooks-web/ List Hooks Web
GET /api/hooks-web/{uuid}/ Retrieve
POST /api/hooks-web/ Create
PUT /api/hooks-web/{uuid}/ Update
PATCH /api/hooks-web/{uuid}/ Partial Update
DELETE /api/hooks-web/{uuid}/ Delete

List Hooks Web

1
2
3
4
http \
  GET \
  https://api.example.com/api/hooks-web/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.hooks_web import hooks_web_list # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = hooks_web_list.sync(client=client)

for item in response:
    print(item)
  1. API Source: hooks_web_list
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import { hooksWebList } from 'waldur-js-client';

try {
  const response = await hooksWebList({
  auth: "Token YOUR_API_TOKEN"
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Description
author_email string
author_fullname string User full name contains
author_username string
author_uuid string (uuid)
content_type integer Enum: 1, 2
destination_url string
is_active boolean
last_published string (date-time)
page integer A page number within the paginated result set.
page_size integer Number of results to return per page.
query string Filter by author name, username and email

200 -

The response body is an array of objects, where each object has the following structure:

Field Type
url string (uri)
uuid string (uuid)
is_active boolean
author_uuid string (uuid)
event_types array of strings
event_groups array of strings
created string (date-time)
modified string (date-time)
hook_type string
author_fullname string
author_username string
author_email string
destination_url string (uri)
content_type string

Retrieve

1
2
3
4
http \
  GET \
  https://api.example.com/api/hooks-web/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.hooks_web import hooks_web_retrieve # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = hooks_web_retrieve.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client
)

print(response)
  1. API Source: hooks_web_retrieve
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { hooksWebRetrieve } from 'waldur-js-client';

try {
  const response = await hooksWebRetrieve({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)

200 -

Field Type
url string (uri)
uuid string (uuid)
is_active boolean
author_uuid string (uuid)
event_types array of strings
event_groups array of strings
created string (date-time)
modified string (date-time)
hook_type string
author_fullname string
author_username string
author_email string
destination_url string (uri)
content_type string

Create

When hook is activated, POST request is issued against destination URL with the following data:

.. code-block:: javascript

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "timestamp": "2015-07-14T12:12:56.000000",
    "message": "Customer ABC LLC has been updated.",
    "type": "customer_update_succeeded",
    "context": {
        "user_native_name": "Walter Lebrowski",
        "customer_contact_details": "",
        "user_username": "Walter",
        "user_uuid": "1c3323fc4ae44120b57ec40dea1be6e6",
        "customer_uuid": "4633bbbb0b3a4b91bffc0e18f853de85",
        "ip_address": "8.8.8.8",
        "user_full_name": "Walter Lebrowski",
        "customer_abbreviation": "ABC LLC",
        "customer_name": "ABC LLC"
    },
    "levelname": "INFO"
}

Note that context depends on event type.

1
2
3
4
5
http \
  POST \
  https://api.example.com/api/hooks-web/ \
  Authorization:"Token YOUR_API_TOKEN" \
  destination_url="https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.web_hook_request import WebHookRequest # (1)
from waldur_api_client.api.hooks_web import hooks_web_create # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = WebHookRequest(
    destination_url="https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = hooks_web_create.sync(
    client=client,
    body=body_data
)

print(response)
  1. Model Source: WebHookRequest
  2. API Source: hooks_web_create
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { hooksWebCreate } from 'waldur-js-client';

try {
  const response = await hooksWebCreate({
  auth: "Token YOUR_API_TOKEN",
  body: {
    "destination_url": "https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Field Type Required
is_active boolean
event_types array of strings
event_groups array of strings
destination_url string (uri)
content_type string

201 -

Field Type
url string (uri)
uuid string (uuid)
is_active boolean
author_uuid string (uuid)
event_types array of strings
event_groups array of strings
created string (date-time)
modified string (date-time)
hook_type string
author_fullname string
author_username string
author_email string
destination_url string (uri)
content_type string

Update

1
2
3
4
5
http \
  PUT \
  https://api.example.com/api/hooks-web/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN" \
  destination_url="https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.web_hook_request import WebHookRequest # (1)
from waldur_api_client.api.hooks_web import hooks_web_update # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = WebHookRequest(
    destination_url="https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = hooks_web_update.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: WebHookRequest
  2. API Source: hooks_web_update
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import { hooksWebUpdate } from 'waldur-js-client';

try {
  const response = await hooksWebUpdate({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  },
  body: {
    "destination_url": "https://api.example.com/api/destination-url/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
is_active boolean
event_types array of strings
event_groups array of strings
destination_url string (uri)
content_type string

200 -

Field Type
url string (uri)
uuid string (uuid)
is_active boolean
author_uuid string (uuid)
event_types array of strings
event_groups array of strings
created string (date-time)
modified string (date-time)
hook_type string
author_fullname string
author_username string
author_email string
destination_url string (uri)
content_type string

Partial Update

1
2
3
4
http \
  PATCH \
  https://api.example.com/api/hooks-web/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.patched_web_hook_request import PatchedWebHookRequest # (1)
from waldur_api_client.api.hooks_web import hooks_web_partial_update # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = PatchedWebHookRequest()
response = hooks_web_partial_update.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: PatchedWebHookRequest
  2. API Source: hooks_web_partial_update
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { hooksWebPartialUpdate } from 'waldur-js-client';

try {
  const response = await hooksWebPartialUpdate({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
is_active boolean
event_types array of strings
event_groups array of strings
destination_url string (uri)
content_type string

200 -

Field Type
url string (uri)
uuid string (uuid)
is_active boolean
author_uuid string (uuid)
event_types array of strings
event_groups array of strings
created string (date-time)
modified string (date-time)
hook_type string
author_fullname string
author_username string
author_email string
destination_url string (uri)
content_type string

Delete

1
2
3
4
http \
  DELETE \
  https://api.example.com/api/hooks-web/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.hooks_web import hooks_web_destroy # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = hooks_web_destroy.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client
)

print(response)
  1. API Source: hooks_web_destroy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { hooksWebDestroy } from 'waldur-js-client';

try {
  const response = await hooksWebDestroy({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)

204 - No response body