Skip to content

Latest commit

 

History

History
300 lines (222 loc) · 11.8 KB

WebhooksApi.md

File metadata and controls

300 lines (222 loc) · 11.8 KB

WebhooksApi

All URIs are relative to https://your-domain.atlassian.com

Method HTTP request Description
deleteWebhookById DELETE /rest/api/3/webhook Delete webhooks by ID
getDynamicWebhooksForApp GET /rest/api/3/webhook Get dynamic webhooks for app
getFailedWebhooks GET /rest/api/3/webhook/failed Get failed webhooks
refreshWebhooks PUT /rest/api/3/webhook/refresh Extend webhook life
registerDynamicWebhooks POST /rest/api/3/webhook Register dynamic webhooks

deleteWebhookById

deleteWebhookById(body)

Delete webhooks by ID

Removes webhooks by ID. Only webhooks registered by the calling Connect app are removed. If webhooks created by other apps are specified, they are ignored. Permissions required: Only Connect apps can use this operation.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

WebhooksApi apiInstance = new WebhooksApi();
ContainerForWebhookIDs body = new ContainerForWebhookIDs(); // ContainerForWebhookIDs | 
try {
    apiInstance.deleteWebhookById(body);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#deleteWebhookById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body ContainerForWebhookIDs

Return type

null (empty response body)

Authorization

OAuth2basicAuth

HTTP request headers

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

getDynamicWebhooksForApp

PageBeanWebhook getDynamicWebhooksForApp(startAt, maxResults)

Get dynamic webhooks for app

Returns a paginated list of the webhooks registered by the calling app. Permissions required: Only Connect apps can use this operation.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

WebhooksApi apiInstance = new WebhooksApi();
Long startAt = 0L; // Long | The index of the first item to return in a page of results (page offset).
Integer maxResults = 100; // Integer | The maximum number of items to return per page.
try {
    PageBeanWebhook result = apiInstance.getDynamicWebhooksForApp(startAt, maxResults);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#getDynamicWebhooksForApp");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
startAt Long The index of the first item to return in a page of results (page offset). [optional] [default to 0]
maxResults Integer The maximum number of items to return per page. [optional] [default to 100]

Return type

PageBeanWebhook

Authorization

OAuth2basicAuth

HTTP request headers

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

getFailedWebhooks

FailedWebhooks getFailedWebhooks(maxResults, after)

Get failed webhooks

Returns webhooks that have recently failed to be delivered to the requesting app after the maximum number of retries. After 72 hours the failure may no longer be returned by this operation. The oldest failure is returned first. This method uses a cursor-based pagination. To request the next page use the failure time of the last webhook on the list as the `failedAfter` value or use the URL provided in `next`. Permissions required: Only Connect apps can use this operation.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

WebhooksApi apiInstance = new WebhooksApi();
Integer maxResults = 56; // Integer | The maximum number of webhooks to return per page. If obeying the maxResults directive would result in records with the same failure time being split across pages, the directive is ignored and all records with the same failure time included on the page.
Long after = 789L; // Long | The time after which any webhook failure must have occurred for the record to be returned, expressed as milliseconds since the UNIX epoch.
try {
    FailedWebhooks result = apiInstance.getFailedWebhooks(maxResults, after);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#getFailedWebhooks");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
maxResults Integer The maximum number of webhooks to return per page. If obeying the maxResults directive would result in records with the same failure time being split across pages, the directive is ignored and all records with the same failure time included on the page. [optional]
after Long The time after which any webhook failure must have occurred for the record to be returned, expressed as milliseconds since the UNIX epoch. [optional]

Return type

FailedWebhooks

Authorization

OAuth2basicAuth

HTTP request headers

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

refreshWebhooks

WebhooksExpirationDate refreshWebhooks(body)

Extend webhook life

Webhooks registered through the REST API expire after 30 days. Call this resource periodically to keep them alive. Unrecognized webhook IDs (nonexistent or belonging to other apps) are ignored. Permissions required: Only Connect apps can use this operation.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

WebhooksApi apiInstance = new WebhooksApi();
ContainerForWebhookIDs body = new ContainerForWebhookIDs(); // ContainerForWebhookIDs | 
try {
    WebhooksExpirationDate result = apiInstance.refreshWebhooks(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#refreshWebhooks");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body ContainerForWebhookIDs

Return type

WebhooksExpirationDate

Authorization

OAuth2basicAuth

HTTP request headers

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

registerDynamicWebhooks

ContainerForRegisteredWebhooks registerDynamicWebhooks(body)

Register dynamic webhooks

Registers webhooks. Permissions required: Only Connect apps can use this operation.

Example

// Import classes:
//import com.xminds.jira.rest.client.ApiClient;
//import com.xminds.jira.rest.client.ApiException;
//import com.xminds.jira.rest.client.Configuration;
//import com.xminds.jira.rest.client.auth.*;
//import com.xminds.jira.rest.client.api.WebhooksApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: OAuth2
OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
OAuth2.setAccessToken("YOUR ACCESS TOKEN");
// Configure HTTP basic authorization: basicAuth
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
basicAuth.setUsername("YOUR USERNAME");
basicAuth.setPassword("YOUR PASSWORD");

WebhooksApi apiInstance = new WebhooksApi();
WebhookRegistrationDetails body = new WebhookRegistrationDetails(); // WebhookRegistrationDetails | 
try {
    ContainerForRegisteredWebhooks result = apiInstance.registerDynamicWebhooks(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling WebhooksApi#registerDynamicWebhooks");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body WebhookRegistrationDetails

Return type

ContainerForRegisteredWebhooks

Authorization

OAuth2basicAuth

HTTP request headers

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