Use the update a connection function in Sitecore CDP REST API

Abstract

How to update a connection in Sitecore CDP (Data model 2.1).

You can use the Connections REST API to perform the update a connection function to return a unique decision model reference. To do this, you must have the ref attribute returned when retrieving the connections.

To update a connection in Sitecore CDP, use the following:

PUT: https://apiEndpoint/v2/connections/<ref>

Attribute

Description

Type

ref

The reference of the connection.

string

{
    "name": "CONNECTION-CAR",
    "description": "car value data system",
    "modifiedByUserRef": "c0728fa5-f380-452e-a0c9-7f4b2632e6fa",
    "modifiedAt": "2018-09-19T12:42:28.416Z",
    "revision": 1,
    "archived": false,
    "auth": {
        "authType": "none"
    },
    "request": {
        "requestType": "post",
        "webServiceUrl": "https://mockserver-proxy-dev.boxever.com/sample/get/oauth",
        "requestBody": "{\"JPY\":\"${JPY}\",\"USD\":\"${USD}\"}"
    },
    "exampleValue": "{\"JPY\":\"JPY\",\"USD\":\"USD\"}",
     "inputMappings":[  
            {  
               "label":"City",
               "key":"city",
               "type":"String",
               "exampleValue":"DUB",
               "mapping":""
            }
         ],
         "outputMappings":[  
            {  
               "label":"Weather At Location",
               "outputReference":"weatherAtLocation",
               "type":"String"
            }
         ],
    "customHeaders": [
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Accept",
            "value": "application/json"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Accept-Encoding",
            "value": "gzip"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Content-Type",
            "value": "application/json"
        }
    ],
    "systemType": "AI",
    "connectionTimeout": 1000,
    "socketTimeout": 1000,
    "icon": "assets/images/connection-images/cloudml.png"
}

The following is a 200 response:

{
    "clientKey": "pqsPERS3lw12v5a9rrHPW1c4hET73GxQ",
    "href": "https://{apiEndpoint}/v2/connections/c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
    "ref": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
    "name": "CONNECTION-CAR",
    "description": "car value data system",
    "modifiedByUserRef": "25f46901-bc51-45e8-b587-148aecf1e48f",
    "modifiedAt": "2018-10-12T14:35:45.110Z",
    "revision": 1,
    "archived": false,
    "auth": {
        "authType": "none"
    },
    "request": {
        "requestType": "post",
        "connectionUrl": "https://mockserver-proxy-dev.boxever.com/sample/get/oauth",
        "requestBody": "{\"JPY\":\"${JPY}\",\"USD\":\"${USD}\"}"
    },
    "exampleValue": "{\"JPY\":\"JPY\",\"USD\":\"USD\"}",
    "inputMappings": [
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "JPY",
            "key": "JPY",
            "type": "string",
            "mapping": ""
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "USD",
            "key": "USD",
            "type": "string",
            "mapping": ""
        }
    ],
    "outputMappings": [
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Success",
            "outputReference": "success",
            "type": "boolean"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Timestamp",
            "outputReference": "timestamp",
            "type": "number"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Base",
            "outputReference": "base",
            "type": "string"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Date",
            "outputReference": "date",
            "type": "string"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Rates",
            "outputReference": "rates",
            "type": "object"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "label": "Cars",
            "outputReference": "cars",
            "type": "array"
        }
    ],
    "customHeaders": [
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Accept",
            "value": "application/json"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Accept-Encoding",
            "value": "gzip"
        },
        {
            "externalConnectionRef": "c3dcdd57-89f9-471f-b3df-ba50bc527c1f",
            "name": "Content-Type",
            "value": "application/json"
        }
    ],
    "systemType": "AI",
    "connectionTimeout": 1000,
    "socketTimeout": 1000,
    "icon": "assets/images/connection-images/cloudml.png"
}