- Introdução
- OpenAPI
Webhook
Github Gist com a especificação das rotas de tratamento de webhooks em OpenAPI v2.
definitions:
CreateEndpointRequest:
properties:
event_types:
example:
- user.created
- user.updated
items:
type: string
minItems: 1
type: array
headers:
additionalProperties:
type: string
example:
Authorization: ' Bearer token'
type: object
secret:
maxLength: 64
minLength: 8
type: string
url:
maxLength: 77
type: string
required:
- event_types
- secret
- url
type: object
ErrorInfo:
properties:
code:
description: Example error code
example: ERR001
type: string
message:
description: Example error message
example: An error occurred
type: string
type: object
Meta:
properties:
request_id:
description: Example request ID
example: "12345"
type: string
timestamp:
description: Example timestamp
example: "2024-01-01T12:00:00Z"
type: string
version:
description: Example version
example: "1.0"
type: string
type: object
PaginatedResponse-WebhookEndpoint:
properties:
data:
description: Example data array
items:
$ref: '#/definitions/WebhookEndpoint'
type: array
error:
allOf:
- $ref: '#/definitions/ErrorInfo'
description: Example error information
meta:
allOf:
- $ref: '#/definitions/Meta'
description: Example metadata
pagination:
allOf:
- $ref: '#/definitions/Pagination'
description: Example pagination
success:
example: true
type: boolean
type: object
Pagination:
properties:
has_next:
example: true
type: boolean
has_prev:
example: false
type: boolean
page:
example: 1
type: integer
page_size:
example: 10
type: integer
total_items:
example: 100
type: integer
total_pages:
example: 10
type: integer
type: object
Response-any:
properties:
data: {}
error:
allOf:
- $ref: '#/definitions/ErrorInfo'
description: Example error information
meta:
allOf:
- $ref: '#/definitions/Meta'
description: Example metadata
success:
example: true
type: boolean
type: object
Response-api_WebhookEndpoint:
properties:
data:
$ref: '#/definitions/WebhookEndpoint'
error:
allOf:
- $ref: '#/definitions/ErrorInfo'
description: Example error information
meta:
allOf:
- $ref: '#/definitions/Meta'
description: Example metadata
success:
example: true
type: boolean
type: object
Response-api_WebhookStatistics:
properties:
data:
$ref: '#/definitions/WebhookStatistics'
error:
allOf:
- $ref: '#/definitions/ErrorInfo'
description: Example error information
meta:
allOf:
- $ref: '#/definitions/Meta'
description: Example metadata
success:
example: true
type: boolean
type: object
WebhookEndpoint:
properties:
create_timestamp:
example: "2024-01-01T00:00:00Z"
type: string
event_types:
example:
- user.created
- user.updated
items:
type: string
minItems: 1
type: array
headers:
additionalProperties:
type: string
example:
Authorization: ' Bearer token'
type: object
identifier:
example: 12345
type: integer
last_modified:
example: "2024-01-02T00:00:00Z"
type: string
secret:
example: mysecret
maxLength: 255
minLength: 1
type: string
status:
allOf:
- $ref: '#/definitions/WebhookEndpointStatus'
enum:
- active
- disabled
- inactive
example: active
url:
example: https://example.com/webhook
maxLength: 77
minLength: 1
type: string
required:
- create_timestamp
- event_types
- identifier
- last_modified
- secret
- status
- url
type: object
WebhookEndpointStatus:
enum:
- active
- disabled
- inactive
type: string
x-enum-comments:
WebhookEndpointStatusDisabled: Status for circuitbreaking scenarios
x-enum-descriptions:
- ""
- Status for circuitbreaking scenarios
- ""
x-enum-varnames:
- WebhookEndpointStatusActive
- WebhookEndpointStatusDisabled
- WebhookEndpointStatusInactive
WebhookStatistics:
properties:
average_response_time_ms:
type: number
endpoint:
$ref: '#/definitions/WebhookEndpoint'
failed_attempts:
type: integer
id:
type: integer
last_failure_at:
type: string
last_success_at:
type: string
pending_events:
description: Populated by the events not in delivered status
type: integer
success_rate:
type: number
successful_attempts:
type: integer
total_attempts:
type: integer
type: object
host: api.qesh.ai
info:
contact:
email: [email protected]
name: Qesh Technology
description: This is the ingress service to communicate with the Webhook Engine
and expose the API for clients.
title: Webhook Ingress
version: "1.0"
paths:
/v1/webhook/endpoints:
post:
consumes:
- application/json
description: Creates a new webhook endpoint for the authenticated user
operationId: create_endpoint
parameters:
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
- description: Endpoint data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/CreateEndpointRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/Response-api_WebhookEndpoint'
- properties:
data:
$ref: '#/definitions/WebhookEndpoint'
type: object
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: Create an Endpoint
tags:
- Endpoint
/v1/webhook/endpoints/{id}:
get:
consumes:
- application/json
description: Retrieves a webhook endpoint by its ID
operationId: get_endpoint_by_id
parameters:
- description: Endpoint ID
in: path
name: id
required: true
type: integer
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/Response-api_WebhookEndpoint'
- properties:
data:
$ref: '#/definitions/WebhookEndpoint'
type: object
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"404":
description: Not Found
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: Get an Endpoint by ID
tags:
- Endpoint
/v1/webhook/endpoints/{id}/disable:
put:
consumes:
- application/json
description: Disables a webhook endpoint by its ID
operationId: disable_endpoint
parameters:
- description: Endpoint ID
in: path
name: id
required: true
type: integer
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: Disable an Endpoint
tags:
- Endpoint
/v1/webhook/endpoints/{id}/enable:
put:
consumes:
- application/json
description: Enables a webhook endpoint by its ID
operationId: enable_endpoint
parameters:
- description: Endpoint ID
in: path
name: id
required: true
type: integer
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: Enable an Endpoint
tags:
- Endpoint
/v1/webhook/endpoints/{id}/statistics:
put:
consumes:
- application/json
description: Retrieves statistics for a webhook endpoint by its ID
operationId: get_endpoint_statistics
parameters:
- description: Endpoint ID
in: path
name: id
required: true
type: integer
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/Response-api_WebhookStatistics'
- properties:
data:
$ref: '#/definitions/WebhookStatistics'
type: object
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: Get Endpoint Statistics
tags:
- Endpoint
/v1/webhook/endpoints/list:
get:
consumes:
- application/json
description: Lists all webhook endpoints for the authenticated user
operationId: list_endpoints
parameters:
- description: Bearer token for authentication
in: header
name: Authorization
required: true
type: string
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Page size
in: query
name: pageSize
type: integer
- description: Initial date in RFC3339 format
in: query
name: initialDate
type: string
- description: Final date in RFC3339 format
in: query
name: finalDate
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/PaginatedResponse-WebhookEndpoint'
- properties:
data:
items:
$ref: '#/definitions/WebhookEndpoint'
type: array
type: object
"204":
description: No Content
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
data:
type: string
type: object
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"422":
description: Unprocessable Entity
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
"503":
description: Service Unavailable
schema:
allOf:
- $ref: '#/definitions/Response-any'
- properties:
error:
$ref: '#/definitions/ErrorInfo'
type: object
summary: List Endpoints
tags:
- Endpoint
securityDefinitions:
BearerAuth:
type: basic
swagger: "2.0"
