Push Events Notification
The Portal Único de Comércio Exterior provides a service for sending event notifications related to ongoing operations status changes.
Those interested in receiving notifications must use the subscription API described below, which is based on the concept of webhook - an integration technology in which the interested party is notified on a previously registered endpoint.
The sections below define the notification API services, which must be accessed after the Portal authentication.
Subscribe event
Example of sending data for event subscription:
{
"evento": "id_evento",
"endpoint": "https://endpoint_a_ser_notificado"
}
Endpoint:
POST https://<url>/portal/api/ext/webhook
Content-Type:
application/json
Input parameters:
Name | Description | Type | Local | Details |
---|---|---|---|---|
evento | Event Identifier (see section ‘List of events for subscription’) | Text(40), required | JSON | |
endpoint | Endpoint that will be notified when the event occurs. | Text(500), required | JSON | Must be a secure URL (HTTPS). |
Response:
Name | Description | Type |
---|---|---|
id | Subscription identifier | Number(10) |
evento | Event identifier (see section ‘List of events for subscription’) | Text(40) |
endpoint | Endpoint that will be notified when the event occurs | Text(500) |
List subscriptions
Lists active subscriptions for the user.
Endpoint:
GET https://<url>/portal/api/ext/webhook
Content-Type:
application/json
Input parameters:
There are no input parameters.
Response:
Name | Description | Type |
---|---|---|
id | Subscription identifier | Number(10) |
evento | Event identifier | Text(40) |
endpoint | Endpoint is notified when the event occurs | Text(500) |
Change subscription
Example of sending data to change an active subscription:
{
"id": 8,
"evento": "id_evento",
"endpoint": "https://endpoint_a_ser_notificado"
}
Endpoint:
PUT https://<url>/portal/api/ext/webhook/{id}
Content-Type:
application/json
Input parameters:
Name | Description | Type | Local | Details |
---|---|---|---|---|
id | Subscription identifier | Number(10), required | JSON | |
evento | Event identifier | Text(40), required | JSON | |
endpoint | Endpoint that will be notified when the event occurs | Text(500), required | JSON | Must be a secure URL (HTTPS). |
Response:
Name | Description | Type |
---|---|---|
id | Subscription identifier | Number(10) |
evento | Event identifier (see section ‘List of events for subscription’) | Text(40) |
endpoint | Endpoint that will be notified when the event occurs | Text(500) |
Delete subscription
Example of sending data to delete an active subscription:
{
"id": 8
}
Endpoint:
DELETE https://<url>/portal/api/ext/webhook/{id}
Content-Type:
application/json
Input parameters:
Name | Description | Type | Local | Details |
---|---|---|---|---|
id | Subscription identifier | Number(10), required | JSON |
Response:
There are no response parameters.
Search failures
It allows to search failures in attempts to send events subscribed by the user.
Example of sending data to search sending failures:
{
"data": 17092018
}
Endpoint:
GET https://<url>/portal/api/ext/webhook/falhas
Content-Type:
application/json
Input Parameters:
Name | Description | Type | Local | Details |
---|---|---|---|---|
data | Record date in ddMMyyyy format | Text(8), optional | JSON | When the date is not informed, the current date will be considered. |
Response:
Name | Description | Type |
---|---|---|
id | Record identifier | Number(10) |
data | Record date | Text(8) |
descricao | Error description | Text |
evento | Related event identifier | Text(40) |
conteudo | Content sent to the endpoint | Text |
Available Events
There is no available events yet.