> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/oms/webhook-event-services.md).

# Webhook Event Services

In the Webhook Event Service, you can publish and resend webhook requests. This service encompasses functionalities such as retrieving a list of webhooks and their details, as well as publishing and resending webhook requests from the OMS.

### `POST` Publish Event

This service is used to publish an event from OMS.

**Path:** `/api/v1/oms/oms_hook_events/publish-event/`

**Payload**

| Parameter | Data Type | In      | Description                           |
| --------- | --------- | ------- | ------------------------------------- |
| hook      | `int`     | payload | Filters the event url                 |
| instance  | `object`  | payload | Filters the event object content type |

**Example Request**

To run this service, a `POST` request should be sent to `/api/v1/oms/oms_hook_events/publish-event/`endpoint.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/oms_hook_events/publish-event/
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

payload = {
            'hook': "webhook.pk",
            'instance': {
                'pk': "package.pk",
                'model': 'package'
            }
        }
response = requests.request("get", url, data=payload, headers=headers)

print(response.text)
```

**Example Response (202 ACCEPTED)**

In a successful response, API returns a response with a status code of `202 ACCEPTED` with an empty response body.

### `POST` Resend Event

This service is used to resend event from OMS.

**Path:** `/api/v1/oms/oms_hook_events/resend-event/`

**Payload**

| Parameter | Data Type | In      | Description       |
| --------- | --------- | ------- | ----------------- |
| event     | `string`  | payload | uuid of the event |

**Example Request**

To run this service, a `POST` request should be sent to `/api/v1/oms/oms_hook_events/resend-event/`endpoint.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/oms_hook_events/publish-event/
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

payload = {
            'event': "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d",
        }
response = requests.request("get", url, data=payload, headers=headers)

print(response.text)
```

**Example Response (200 OK)**

In a successful response, API returns a response with a status code of `200 OK` with an empty response body.

### `GET` List of Webhooks

This service is used to get a list of webhooks from OMS.

**Path:** `/api/v1/oms/oms_hook_events/`

**Payload**

No payload is required.

**Example Request**

To run this service, a `GET` request should be sent to `/api/v1/oms/oms_hook_events/` endpoint.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/oms_hook_events/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("get", url, headers=headers)

print(response.text)
```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK` the response body contains list of webhook objects.

These parameters are described in the following table.

| Parameter              | Data Type | Description                         |
| ---------------------- | --------- | ----------------------------------- |
| id                     | int       | Unique id of the webhook            |
| webhook                | object    | Details of the webhook              |
| created\_date          | datetime  | Date and time of webhook created    |
| updated\_date          | datetime  | Date and time of webhook updated    |
| uuid                   | string    | Unique id of the webhook            |
| request\_payload       | object    | Request payload of the webhook      |
| response\_content      | object    | Response content of the webhook     |
| response\_http\_status | int       | Response http status of the webhook |
| delivered              | boolean   | Delivery status of the webhook      |
| request\_datetimes     | datetime  | Date and time of webhook request    |
| retry\_count           | int       | Retry count of the webhook          |
| object\_id             | int       | Object id used in webhook           |
| content\_type          | string    | Content type of the object          |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
    {
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 3,
            "webhook": {
                "id": 1,
                "retry_countdown_config": {
                    "choice": "exponential",
                    "kwargs": {
                        "base": 2
                    }
                },
                "created_date": "2024-02-19T08:12:18.591206Z",
                "modified_date": "2024-02-19T08:12:18.591211Z",
                "target_url": "http://www.zjdaxliadjwylwuqwicp.com/",
                "is_active": true,
                "secret_key": "esGmJGCSbxJUsYqsPFEeMiSpPqcqABPIGxFLNPDuFmKKQEVyecoHRTUAWyaphTep",
                "event_type": "package.created",
                "callback": null,
                "additional_headers": {},
                "config": {}
            },
            "created_date": "2024-02-19T08:12:18.793672Z",
            "modified_date": "2024-02-19T08:12:18.793681Z",
            "uuid": "d2a839f0-09cc-4755-a731-081d4cc1330a",
            "request_payload": {
                "event": {
                    "type": "package.created",
                    "uuid": "dfb06848cd3a48458e2f5c64006fd350"
                },
                "payload": {}
            },
            "response_content": {},
            "response_http_status": 200,
            "delivered": false,
            "request_datetimes": [],
            "retry_count": null,
            "object_id": 1,
            "content_type": 3
        }
    ]
}

```

### `GET` Webhook Detail

This service is used to get webhook detail from OMS.

**Path:** `/api/v1/oms/oms_hook_events/{pk}/`

**Payload**

No payload is required.

**Example Request**

To run this service, a `GET` request should be sent to `/api/v1/oms/oms_hook_events/{pk}/` endpoint.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/oms_hook_events/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("get", url, headers=headers)

print(response.text)
```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK` the response body contains webhook object.

These parameters are described in the following table.

| Parameter              | Data Type | Description                         |
| ---------------------- | --------- | ----------------------------------- |
| id                     | int       | Unique id of the webhook            |
| webhook                | object    | Details of the webhook              |
| created\_date          | datetime  | Date and time of webhook created    |
| updated\_date          | datetime  | Date and time of webhook updated    |
| uuid                   | string    | Unique id of the webhook            |
| request\_payload       | object    | Request payload of the webhook      |
| response\_content      | object    | Response content of the webhook     |
| response\_http\_status | int       | Response http status of the webhook |
| delivered              | boolean   | Delivery status of the webhook      |
| request\_datetimes     | datetime  | Date and time of webhook request    |
| retry\_count           | int       | Retry count of the webhook          |
| object\_id             | int       | Object id used in webhook           |
| content\_type          | string    | Content type of the object          |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
{
            "id": 3,
            "webhook": {
                "id": 1,
                "retry_countdown_config": {
                    "choice": "exponential",
                    "kwargs": {
                        "base": 2
                    }
                },
                "created_date": "2024-02-19T08:12:18.591206Z",
                "modified_date": "2024-02-19T08:12:18.591211Z",
                "target_url": "http://www.zjdaxliadjwylwuqwicp.com/",
                "is_active": true,
                "secret_key": "esGmJGCSbxJUsYqsPFEeMiSpPqcqABPIGxFLNPDuFmKKQEVyecoHRTUAWyaphTep",
                "event_type": "package.created",
                "callback": null,
                "additional_headers": {},
                "config": {}
            },
            "created_date": "2024-02-19T08:12:18.793672Z",
            "modified_date": "2024-02-19T08:12:18.793681Z",
            "uuid": "d2a839f0-09cc-4755-a731-081d4cc1330a",
            "request_payload": {
                "event": {
                    "type": "package.created",
                    "uuid": "dfb06848cd3a48458e2f5c64006fd350"
                },
                "payload": {}
            },
            "response_content": "false",
            "response_http_status": 200,
            "delivered": false,
            "request_datetimes": [],
            "retry_count": null,
            "object_id": 1,
            "content_type": 3
        }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apidocs.akinon.com/oms/webhook-event-services.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
