Skip to content

Latest commit

 

History

History
322 lines (286 loc) · 21.4 KB

File metadata and controls

322 lines (286 loc) · 21.4 KB

ConnectionSettings

(vault.connection_settings)

Overview

Available Operations

  • list - Get resource settings
  • update - Update settings

list

This endpoint returns custom settings and their defaults required by connection for a given resource.

Example Usage

from apideck_unify import Apideck
import os


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

    res = apideck.vault.connection_settings.list(unified_api="crm", service_id="pipedrive", resource="leads")

    assert res.get_connection_response is not None

    # Handle response
    print(res.get_connection_response)

Parameters

Parameter Type Required Description Example
unified_api str ✔️ Unified API crm
service_id str ✔️ Service ID of the resource to return pipedrive
resource str ✔️ Name of the resource (plural) leads
consumer_id Optional[str] ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionSettingsAllResponse

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 default values for a connection's resource settings

Example Usage

import apideck_unify
from apideck_unify import Apideck
import os


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

    res = apideck.vault.connection_settings.update(service_id="pipedrive", unified_api="crm", resource="leads", 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": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
            ],
        },
        {
            "resource": "leads",
            "defaults": [
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
                {
                    "id": "ProductInterest",
                    "options": [
                        {
                            "label": "General Channel",
                            "value": 12.5,
                            "option_type": apideck_unify.OptionType.SIMPLE,
                        },
                    ],
                    "value": "GC5000 series",
                },
            ],
        },
    ], custom_mappings=[
        {
            "value": "$.root.training.first_aid",
        },
        {
            "value": "$.root.training.first_aid",
        },
    ], consent_state=apideck_unify.ConsentState.GRANTED, latest_consent={
        "granted": True,
        "resources": {
            "hris.employees": {
                "id": {
                    "read": True,
                    "write": False,
                },
                "first_name": {
                    "read": True,
                    "write": True,
                },
                "last_name": {
                    "read": True,
                    "write": True,
                },
                "email": {
                    "read": True,
                    "write": True,
                },
                "addresses[].street": {
                    "read": True,
                    "write": False,
                },
                "addresses[].city": {
                    "read": True,
                    "write": False,
                },
                "employment.job_title": {
                    "read": True,
                    "write": True,
                },
                "custom_fields[].employee_number": {
                    "read": True,
                    "write": False,
                },
            },
            "hris.departments": {
                "id": {
                    "read": True,
                    "write": False,
                },
                "name": {
                    "read": True,
                    "write": True,
                },
                "code": {
                    "read": True,
                    "write": False,
                },
            },
        },
    }, application_data_scopes={
        "enabled": True,
        "resources": {
            "hris.employees": {
                "id": {
                    "read": True,
                    "write": False,
                },
                "first_name": {
                    "read": True,
                    "write": True,
                },
                "last_name": {
                    "read": True,
                    "write": True,
                },
                "email": {
                    "read": True,
                    "write": True,
                },
                "addresses[].street": {
                    "read": True,
                    "write": False,
                },
                "addresses[].city": {
                    "read": True,
                    "write": False,
                },
                "employment.job_title": {
                    "read": True,
                    "write": True,
                },
                "custom_fields[].employee_number": {
                    "read": True,
                    "write": False,
                },
            },
            "hris.departments": {
                "id": {
                    "read": True,
                    "write": False,
                },
                "name": {
                    "read": True,
                    "write": True,
                },
                "code": {
                    "read": True,
                    "write": False,
                },
            },
        },
    })

    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
resource str ✔️ Name of the resource (plural) leads
consumer_id Optional[str] ID of the consumer which you want to get or push data from test-consumer
app_id Optional[str] The ID of your Unify application dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX
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
consent_state Optional[models.ConsentState] The current consent state of the connection granted
latest_consent Optional[models.ConsentRecordInput] N/A
application_data_scopes Optional[models.DataScopesInput] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.VaultConnectionSettingsUpdateResponse

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