# TransferzeroSdk.WebhooksApi
All URIs are relative to *https://api-sandbox.transferzero.com/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**deleteWebhook**](WebhooksApi.md#deleteWebhook) | **DELETE** /webhooks/{Webhook ID} | Unsubscribing from a webhook
[**getWebhook**](WebhooksApi.md#getWebhook) | **GET** /webhooks/{Webhook ID} | Find a webhook's details
[**getWebhookEvents**](WebhooksApi.md#getWebhookEvents) | **GET** /webhooks/events | Find possible webhook events
[**getWebhooks**](WebhooksApi.md#getWebhooks) | **GET** /webhooks | Listing webhooks
[**postWebhooks**](WebhooksApi.md#postWebhooks) | **POST** /webhooks | Creating a webhook
# **deleteWebhook**
> WebhookDefinitionResponse deleteWebhook(webhookID)
Unsubscribing from a webhook
Unsubscribes from a webhook specified
### Example
```javascript
import { WebhooksApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new WebhooksApi(apiClient);
apiInstance.deleteWebhook(webhookID).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling WebhooksApi#deleteWebhook");
throw error;
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**webhookID** | **String**| The ID of webhook to cancel. Example: `/v1/webhooks/9d4d7b73-a94c-4979-ab57-09074fd55d33` |
### Return type
[**WebhookDefinitionResponse**](WebhookDefinitionResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getWebhook**
> WebhookDefinitionResponse getWebhook(webhookID)
Find a webhook's details
Look up a webhook's details with its ID
### Example
```javascript
import { WebhooksApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new WebhooksApi(apiClient);
apiInstance.getWebhook(webhookID).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling WebhooksApi#getWebhook");
throw error;
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**webhookID** | [**String**](.md)| The ID of the Webhook to look up Example: `/v1/webhooks/9d4d7b73-a94c-4979-ab57-09074fd55d33` |
### Return type
[**WebhookDefinitionResponse**](WebhookDefinitionResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getWebhookEvents**
> WebhookDefinitionEventListResponse getWebhookEvents()
Find possible webhook events
Fetching possible webhook events
### Example
```javascript
import { WebhooksApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new WebhooksApi(apiClient);
apiInstance.getWebhookEvents().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling WebhooksApi#getWebhookEvents");
throw error;
}
});
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**WebhookDefinitionEventListResponse**](WebhookDefinitionEventListResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getWebhooks**
> WebhookDefinitionListResponse getWebhooks(opts)
Listing webhooks
Get a list of created webhooks
### Example
```javascript
import { WebhooksApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new WebhooksApi(apiClient);
let opts = {
'page': 1 // Number | The page number to request (defaults to 1)
'per': 10 // Number | The number of results to load per page (defaults to 10)
};
apiInstance.getWebhooks(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling WebhooksApi#getWebhooks");
throw error;
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page** | **Number**| The page number to request (defaults to 1) | [optional]
**per** | **Number**| The number of results to load per page (defaults to 10) | [optional]
### Return type
[**WebhookDefinitionListResponse**](WebhookDefinitionListResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **postWebhooks**
> WebhookDefinitionResponse postWebhooks(webhookDefinitionRequest)
Creating a webhook
Creates a new webhook, subscribing the provided endpoint to the specified event(s)
### Example
```javascript
import { WebhooksApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new WebhooksApi(apiClient);
apiInstance.postWebhooks(webhookDefinitionRequest).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling WebhooksApi#postWebhooks");
throw error;
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**webhookDefinitionRequest** | [**WebhookDefinitionRequest**](WebhookDefinitionRequest.md)| |
### Return type
[**WebhookDefinitionResponse**](WebhookDefinitionResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json