Skip to content

Latest commit

 

History

History
485 lines (385 loc) · 43.2 KB

README.md

File metadata and controls

485 lines (385 loc) · 43.2 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

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.list(api="crm", configured=True)

    assert res.get_connections_response is not None

    # Handle response
    print(res.get_connections_response)

Parameters

Parameter Type Required Description Example
api Optional[str] Scope results to Unified API crm
configured Optional[bool] Scopes results to connections that have been configured or not true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsAllResponse

Errors

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

get

Get a connection

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.get(service_id="pipedrive", unified_api="crm")

    assert res.get_connection_response is not None

    # Handle response
    print(res.get_connection_response)

Parameters

Parameter Type Required Description Example
service_id str ✔️ Service ID of the resource to return pipedrive
unified_api str ✔️ Unified API crm
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsOneResponse

Errors

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

update

Update a connection

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.update(service_id="pipedrive", unified_api="crm", enabled=True, settings={
        "instance_url": "https://eu28.salesforce.com",
        "api_key": "12345xxxxxx",
    }, metadata={
        "account": {
            "name": "My Company",
            "id": "c01458a5-7276-41ce-bc19-639906b0450a",
        },
        "plan": "enterprise",
    }, configuration=[
        {
            "resource": "leads",
            "defaults": [
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "id": "1234",
                            "label": "General Channel",
                            "options": [
                                {
                                    "label": "General Channel",
                                    "value": 12.5,
                                },
                                {
                                    "label": "General Channel",
                                    "value": [
                                        "team",
                                        "general",
                                    ],
                                },
                            ],
                        },
                    ],
                    "value": "GC5000 series",
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 123,
                        },
                        {
                            "label": "General Channel",
                            "value": "general",
                        },
                        {
                            "id": "1234",
                            "label": "General Channel",
                            "options": [
                                {
                                    "label": "General Channel",
                                    "value": 123,
                                },
                                {
                                    "label": "General Channel",
                                    "value": 12.5,
                                },
                                {
                                    "label": "General Channel",
                                    "value": True,
                                },
                            ],
                        },
                    ],
                    "value": True,
                },
            ],
        },
        {
            "resource": "leads",
            "defaults": [
                {
                    "id": "ProductInterest",
                    "options": [

                    ],
                    "value": True,
                },
            ],
        },
        {
            "resource": "leads",
            "defaults": [
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "id": "1234",
                            "label": "General Channel",
                            "options": [

                            ],
                        },
                    ],
                    "value": 10,
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "id": "1234",
                            "label": "General Channel",
                            "options": [
                                {
                                    "label": "General Channel",
                                    "value": [
                                        "team",
                                        "general",
                                    ],
                                },
                                {
                                    "label": "General Channel",
                                    "value": True,
                                },
                                {
                                    "label": "General Channel",
                                    "value": 12.5,
                                },
                            ],
                        },
                    ],
                    "value": 10,
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "id": "1234",
                            "label": "General Channel",
                            "options": [
                                {
                                    "label": "General Channel",
                                    "value": [
                                        "team",
                                        "general",
                                    ],
                                },
                                {
                                    "label": "General Channel",
                                    "value": "general",
                                },
                            ],
                        },
                        {
                            "label": "General Channel",
                            "value": 123,
                        },
                    ],
                    "value": True,
                },
            ],
        },
    ], custom_mappings=[

    ])

    assert res.update_connection_response is not None

    # Handle response
    print(res.update_connection_response)

Parameters

Parameter Type Required Description Example
service_id str ✔️ Service ID of the resource to return pipedrive
unified_api str ✔️ Unified API crm
enabled Optional[bool] Whether the connection is enabled or not. You can enable or disable a connection using the Update Connection API. true
settings Dict[str, Any] Connection settings. Values will persist to form_fields with corresponding id {
"instance_url": "https://eu28.salesforce.com",
"api_key": "12345xxxxxx"
}
metadata Dict[str, Any] Attach your own consumer specific metadata {
"account": {
"name": "My Company",
"id": "c01458a5-7276-41ce-bc19-639906b0450a"
},
"plan": "enterprise"
}
configuration List[models.ConnectionConfiguration] N/A
custom_mappings List[models.CustomMappingInput] List of custom mappings configured for this connection
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsUpdateResponse

Errors

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

delete

Deletes a connection

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.delete(service_id="pipedrive", unified_api="crm")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
service_id str ✔️ Service ID of the resource to return pipedrive
unified_api str ✔️ Unified API crm
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsDeleteResponse

Errors

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

imports

Import an authorized connection.

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.imports(service_id="pipedrive", unified_api="crm", credentials={
        "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.cThIIoDvwdueQB468K5xDc5633seEFoqwxjF_xSJyQQ",
        "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
    }, settings={}, metadata={
        "account": {
            "name": "My Company",
            "id": "c01458a5-7276-41ce-bc19-639906b0450a",
        },
        "plan": "enterprise",
    })

    assert res.create_connection_response is not None

    # Handle response
    print(res.create_connection_response)

Parameters

Parameter Type Required Description Example
service_id str ✔️ Service ID of the resource to return pipedrive
unified_api str ✔️ Unified API crm
credentials Optional[models.Credentials] N/A {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.cThIIoDvwdueQB468K5xDc5633seEFoqwxjF_xSJyQQ"
}
settings OptionalNullable[models.ConnectionImportDataSettings] Connection settings. Values will persist to form_fields with corresponding id {
"instance_url": "https://eu28.salesforce.com"
}
metadata Dict[str, Any] Attach your own consumer specific metadata {
"account": {
"name": "My Company",
"id": "c01458a5-7276-41ce-bc19-639906b0450a"
},
"plan": "enterprise"
}
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsImportResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 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

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.vault.connections.token(service_id="pipedrive", unified_api="crm")

    assert res.get_connection_response is not None

    # Handle response
    print(res.get_connection_response)

Parameters

Parameter Type Required Description Example
service_id str ✔️ Service ID of the resource to return pipedrive
unified_api str ✔️ Unified API crm
request_body Optional[models.VaultConnectionsTokenRequestBody] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionsTokenResponse

Errors

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