Skip to content

Latest commit

 

History

History
372 lines (277 loc) · 11.5 KB

WebhooksApi.md

File metadata and controls

372 lines (277 loc) · 11.5 KB

WebhooksApi

All URIs are relative to https://api.brevo.com/v3

Method HTTP request Description
createWebhook POST /webhooks Create a webhook
deleteWebhook DELETE /webhooks/{webhookId} Delete a webhook
exportWebhooksHistory POST /webhooks/export Export all webhook events
getWebhook GET /webhooks/{webhookId} Get a webhook details
getWebhooks GET /webhooks Get all webhooks
updateWebhook PUT /webhooks/{webhookId} Update a webhook

createWebhook

CreateModel createWebhook(createWebhook)

Create a webhook

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
CreateWebhook createWebhook = new CreateWebhook(); // CreateWebhook | Values to create a webhook
try {
    CreateModel result = apiInstance.createWebhook(createWebhook);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#createWebhook");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
createWebhook CreateWebhook Values to create a webhook

Return type

CreateModel

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteWebhook

deleteWebhook(webhookId)

Delete a webhook

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
Long webhookId = 789L; // Long | Id of the webhook
try {
    apiInstance.deleteWebhook(webhookId);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#deleteWebhook");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
webhookId Long Id of the webhook

Return type

null (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

exportWebhooksHistory

CreatedProcessId exportWebhooksHistory(exportWebhookHistory)

Export all webhook events

This endpoint will submit a request to get the history of webhooks in the CSV file. The link to download the CSV file will be sent to the webhook that was provided in the notifyURL.

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
ExportWebhooksHistory exportWebhookHistory = new ExportWebhooksHistory(); // ExportWebhooksHistory | Values to submit for webhooks history
try {
    CreatedProcessId result = apiInstance.exportWebhooksHistory(exportWebhookHistory);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#exportWebhooksHistory");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
exportWebhookHistory ExportWebhooksHistory Values to submit for webhooks history

Return type

CreatedProcessId

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getWebhook

GetWebhook getWebhook(webhookId)

Get a webhook details

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
Long webhookId = 789L; // Long | Id of the webhook
try {
    GetWebhook result = apiInstance.getWebhook(webhookId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#getWebhook");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
webhookId Long Id of the webhook

Return type

GetWebhook

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getWebhooks

GetWebhooks getWebhooks(type, sort)

Get all webhooks

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
String type = "transactional"; // String | Filter on webhook type
String sort = "desc"; // String | Sort the results in the ascending/descending order of webhook creation
try {
    GetWebhooks result = apiInstance.getWebhooks(type, sort);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#getWebhooks");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
type String Filter on webhook type [optional] [default to transactional] [enum: marketing, transactional, inbound]
sort String Sort the results in the ascending/descending order of webhook creation [optional] [default to desc] [enum: asc, desc]

Return type

GetWebhooks

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateWebhook

updateWebhook(webhookId, updateWebhook)

Update a webhook

Example

// Import classes:
//import brevo.ApiClient;
//import brevo.ApiException;
//import brevo.Configuration;
//import brevo.auth.*;
//import brevoApi.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api-key
ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("api-key");
apiKey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.setApiKeyPrefix("Token");

// Configure API key authorization: partner-key
ApiKeyAuth partnerKey = (ApiKeyAuth) defaultClient.getAuthentication("partner-key");
partnerKey.setApiKey("YOUR PARTNER KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.setApiKeyPrefix("Token");

WebhooksApi apiInstance = new WebhooksApi();
Long webhookId = 789L; // Long | Id of the webhook
UpdateWebhook updateWebhook = new UpdateWebhook(); // UpdateWebhook | Values to update a webhook
try {
    apiInstance.updateWebhook(webhookId, updateWebhook);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#updateWebhook");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
webhookId Long Id of the webhook
updateWebhook UpdateWebhook Values to update a webhook

Return type

null (empty response body)

Authorization

api-key, partner-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json