Skip to content

Latest commit

 

History

History
381 lines (293 loc) · 24.5 KB

README.md

File metadata and controls

381 lines (293 loc) · 24.5 KB

Connections

(Vault.Connections)

Overview

Available Operations

  • List - Get all connections
  • Get - Get connection
  • Update - Update connection
  • Delete - Deletes a connection
  • Imports - Import connection
  • Token - Authorize Access Token

List

This endpoint includes all the configured integrations and contains the required assets to build an integrations page where your users can install integrations. OAuth2 supported integrations will contain authorize and revoke links to handle the authentication flows.

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

var res = await sdk.Vault.Connections.ListAsync(
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
    api: "crm",
    configured: true
);

// handle response

Parameters

Parameter Type Required Description Example
ConsumerId string ID of the consumer which you want to get or push data from test-consumer
AppId string The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
Api string Scope results to Unified API crm
Configured bool Scopes results to connections that have been configured or not true

Response

VaultConnectionsAllResponse

Errors

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

Get

Get a connection

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

var res = await sdk.Vault.Connections.GetAsync(
    serviceId: "pipedrive",
    unifiedApi: "crm",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

// handle response

Parameters

Parameter Type Required Description Example
ServiceId string ✔️ Service ID of the resource to return pipedrive
UnifiedApi string ✔️ Unified API crm
ConsumerId string ID of the consumer which you want to get or push data from test-consumer
AppId string The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX

Response

VaultConnectionsOneResponse

Errors

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

Update

Update a connection

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

VaultConnectionsUpdateRequest req = new VaultConnectionsUpdateRequest() {
    ServiceId = "pipedrive",
    UnifiedApi = "crm",
    Connection = new ConnectionInput() {
        Enabled = true,
        Settings = new Dictionary<string, object>() {
            { "instance_url", "https://eu28.salesforce.com" },
            { "api_key", "12345xxxxxx" },
        },
        Metadata = new Dictionary<string, object>() {
            { "account", new Dictionary<string, object>() {
                { "name", "My Company" },
                { "id", "c01458a5-7276-41ce-bc19-639906b0450a" },
            } },
            { "plan", "enterprise" },
        },
        Configuration = new List<ConnectionConfiguration>() {
            new ConnectionConfiguration() {
                Resource = "leads",
                Defaults = new List<ConnectionDefaults>() {
                    new ConnectionDefaults() {
                        Id = "ProductInterest",
                        Options = new List<FormFieldOption>() {
                            FormFieldOption.CreateFormFieldOptionGroup(
                                new FormFieldOptionGroup() {
                                    Id = "1234",
                                    Label = "General Channel",
                                    Options = new List<SimpleFormFieldOption>() {
                                        new SimpleFormFieldOption() {
                                            Label = "General Channel",
                                            Value = SimpleFormFieldOptionValue.CreateNumber(
                                                12.5D
                                            ),
                                        },
                                    },
                                }
                            ),
                        },
                        Value = ConnectionValue.CreateInteger(
                            10
                        ),
                    },
                },
            },
        },
        CustomMappings = new List<CustomMappingInput>() {
            new CustomMappingInput() {
                Value = "$.root.training.first_aid",
            },
        },
    },
};

var res = await sdk.Vault.Connections.UpdateAsync(req);

// handle response

Parameters

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

Response

VaultConnectionsUpdateResponse

Errors

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

Delete

Deletes a connection

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

var res = await sdk.Vault.Connections.DeleteAsync(
    serviceId: "pipedrive",
    unifiedApi: "crm",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

// handle response

Parameters

Parameter Type Required Description Example
ServiceId string ✔️ Service ID of the resource to return pipedrive
UnifiedApi string ✔️ Unified API crm
ConsumerId string ID of the consumer which you want to get or push data from test-consumer
AppId string The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX

Response

VaultConnectionsDeleteResponse

Errors

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

Imports

Import an authorized connection.

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;
using System.Collections.Generic;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

VaultConnectionsImportRequest req = new VaultConnectionsImportRequest() {
    ServiceId = "pipedrive",
    UnifiedApi = "crm",
    ConnectionImportData = new ConnectionImportData() {
        Credentials = new Credentials() {
            RefreshToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.cThIIoDvwdueQB468K5xDc5633seEFoqwxjF_xSJyQQ",
            AccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
        },
        Settings = new ConnectionImportDataSettings() {},
        Metadata = new Dictionary<string, object>() {
            { "account", new Dictionary<string, object>() {
                { "name", "My Company" },
                { "id", "c01458a5-7276-41ce-bc19-639906b0450a" },
            } },
            { "plan", "enterprise" },
        },
    },
};

var res = await sdk.Vault.Connections.ImportsAsync(req);

// handle response

Parameters

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

Response

VaultConnectionsImportResponse

Errors

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

Token

Triggers exchanging persisted connection credentials for an access token and store it in Vault. Currently supported for connections with the client_credentials or password OAuth grant type.

Note:

  • Do not include any credentials in the request body. This operation does not persist changes, but only triggers the exchange of persisted connection credentials for an access token.
  • The access token will not be returned in the response. A 200 response code indicates the authorization was successful and that a valid access token was stored on the connection.
  • The access token will be used for subsequent API requests.

Example Usage

using ApideckUnifySdk;
using ApideckUnifySdk.Models.Components;
using ApideckUnifySdk.Models.Requests;

var sdk = new Apideck(
    apiKey: "<YOUR_BEARER_TOKEN_HERE>",
    consumerId: "test-consumer",
    appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"
);

VaultConnectionsTokenRequest req = new VaultConnectionsTokenRequest() {
    ServiceId = "pipedrive",
    UnifiedApi = "crm",
};

var res = await sdk.Vault.Connections.TokenAsync(req);

// handle response

Parameters

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

Response

VaultConnectionsTokenResponse

Errors

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