Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 4.51 KB

README.md

File metadata and controls

80 lines (58 loc) · 4.51 KB

ValidateConnection

(vault().validateConnection())

Overview

Available Operations

  • state - Validate Connection State

state

This endpoint validates the current state of a given connection. This will perform different checks based on the connection auth type. For basic and apiKey auth types, the presence of required fields is checked. For connectors that implement OAuth2, this operation forces the refresh flow for an access token regardless of its expiry.

Note:

  • Do not include any credentials in the request body. This operation does not persist changes, but only triggers the validation of connection state.
  • If a refresh token flow was performed and successful, the new access token will then be used for subsequent API requests.

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.VaultValidateConnectionStateRequest;
import com.apideck.unify.models.operations.VaultValidateConnectionStateResponse;
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_BEARER_TOKEN_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        VaultValidateConnectionStateRequest req = VaultValidateConnectionStateRequest.builder()
                .serviceId("pipedrive")
                .unifiedApi("crm")
                .build();

        VaultValidateConnectionStateResponse res = sdk.vault().validateConnection().state()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request VaultValidateConnectionStateRequest ✔️ The request object to use for the request.

Response

VaultValidateConnectionStateResponse

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 */*