Skip to content

Latest commit

 

History

History
350 lines (267 loc) · 23.9 KB

README.md

File metadata and controls

350 lines (267 loc) · 23.9 KB

Webhooks

(webhook().webhooks())

Overview

Available Operations

  • list - List webhook subscriptions
  • create - Create webhook subscription
  • get - Get webhook subscription
  • update - Update webhook subscription
  • delete - Delete webhook subscription

list

List all webhook subscriptions

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.WebhookWebhooksAllResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        WebhookWebhooksAllResponse res = sdk.webhook().webhooks().list()
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
                .cursor("<value>")
                .limit(20L)
                .call();

        if (res.getWebhooksResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
cursor JsonNullable<String> Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit Optional<Long> Number of results to return. Minimum 1, Maximum 200, Default 20

Response

WebhookWebhooksAllResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*

create

Create a webhook subscription to receive events

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.CreateWebhookRequest;
import com.apideck.unify.models.components.Status;
import com.apideck.unify.models.components.UnifiedApiId;
import com.apideck.unify.models.components.WebhookEventType;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.WebhookWebhooksAddResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        WebhookWebhooksAddResponse res = sdk.webhook().webhooks().create()
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
                .createWebhookRequest(CreateWebhookRequest.builder()
                    .unifiedApi(UnifiedApiId.CRM)
                    .status(Status.ENABLED)
                    .deliveryUrl("https://example.com/my/webhook/endpoint")
                    .events(List.of(
                        WebhookEventType.VAULT_CONNECTION_CREATED,
                        WebhookEventType.VAULT_CONNECTION_UPDATED))
                    .description("A description")
                    .build())
                .call();

        if (res.createWebhookResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
createWebhookRequest CreateWebhookRequest ✔️ N/A

Response

WebhookWebhooksAddResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*

get

Get the webhook subscription details

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.WebhookWebhooksOneResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        WebhookWebhooksOneResponse res = sdk.webhook().webhooks().get()
                .id("<id>")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
                .call();

        if (res.getWebhookResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
id String ✔️ JWT Webhook token that represents the unifiedApi and applicationId associated to the event source.
appId Optional<String> The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX

Response

WebhookWebhooksOneResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*

update

Update a webhook subscription

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.Status;
import com.apideck.unify.models.components.UpdateWebhookRequest;
import com.apideck.unify.models.components.WebhookEventType;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.WebhookWebhooksUpdateResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        WebhookWebhooksUpdateResponse res = sdk.webhook().webhooks().update()
                .id("<id>")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
                .updateWebhookRequest(UpdateWebhookRequest.builder()
                    .description("A description")
                    .status(Status.ENABLED)
                    .deliveryUrl("https://example.com/my/webhook/endpoint")
                    .events(List.of(
                        WebhookEventType.VAULT_CONNECTION_CREATED,
                        WebhookEventType.VAULT_CONNECTION_UPDATED))
                    .build())
                .call();

        if (res.updateWebhookResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
id String ✔️ JWT Webhook token that represents the unifiedApi and applicationId associated to the event source.
appId Optional<String> The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
updateWebhookRequest UpdateWebhookRequest ✔️ N/A

Response

WebhookWebhooksUpdateResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*

delete

Delete a webhook subscription

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.WebhookWebhooksDeleteResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        WebhookWebhooksDeleteResponse res = sdk.webhook().webhooks().delete()
                .id("<id>")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
                .call();

        if (res.deleteWebhookResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
id String ✔️ JWT Webhook token that represents the unifiedApi and applicationId associated to the event source.
appId Optional<String> The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX

Response

WebhookWebhooksDeleteResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*