Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 4.75 KB

README.md

File metadata and controls

76 lines (57 loc) · 4.75 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 main

import(
	"context"
	"os"
	sdkgo "github.com/apideck-libraries/sdk-go"
	"github.com/apideck-libraries/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
    )

    res, err := s.Vault.ValidateConnection.State(ctx, operations.VaultValidateConnectionStateRequest{
        ServiceID: "pipedrive",
        UnifiedAPI: "crm",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ValidateConnectionStateResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.VaultValidateConnectionStateRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.VaultValidateConnectionStateResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*