Skip to main content

Use the create a connection function in Sitecore CDP REST API

Abstract

How to create a connection to an external service in Sitecore CDP (Data model 2.1).

You can use the Connection REST API to perform the create connection function to create a connection to an external service.

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

POST: https://apiEndpoint/v2/connections

{
  "type": "string",
  "name": "Weather Data System",
  "description": "openweathermap.org connection",
  "modifiedByUserRef": "c008c81d-4941-46aa-b4e6-a17e8388498a",
  "modifiedAt": "2018-10-05T12:14:20.136Z",
  "revision": 0,
  "revisionComment": "first connection config",
  "archived": false,
  "auth": {
    "authType": "oauth"
  },
  "request": {
    "requestType": "get",
    "connectionUrl": "https://mockserver-proxy-dev.boxever.com/sample/get/basicauth"
  },
  "exampleValue": "string",
   "inputMappings":[  
            {  
               "label":"City",
               "key":"city",
               "type":"String",
               "exampleValue":"DUB",
               "mapping":""
            }
         ],
         "outputMappings":[  
            {  
               "label":"Weather At Location",
               "outputReference":"weatherAtLocation",
               "type":"String"
            }
         ],
  "customHeaders": [
    {
      "externalConnectionRef": "8ad39f25-d75b-44b5-bcd0-b8f92ead9ba5",
      "name": "Accept",
      "value": "application/json"
    }
  ],
  "systemType": "DATA_SYSTEM",
  "connectionTimeout": 1000,
  "socketTimeout": 1000,
  "icon": "assets/images/icons/connections/predict-hq.png"
}

The following is a 201 response:

{
 "type": "string",
 "clientKey":"pqsPERS3lw12v5a9rrHPW1c4hET73GxQ",
 "href":"https://dev-api.boxever.com/v2/externalWebServices/1a82b284-4415-4205-94d6-b716e2aea6a8",
  "ref":"1a82b284-4415-4205-94d6-b716e2aea6a8",
  "name": "Weather Data System",
  "description": "openweathermap.org connection",
  "modifiedByUserRef": "c008c81d-4941-46aa-b4e6-a17e8388498a",
  "modifiedAt": "2018-10-05T12:14:20.136Z",
  "revision": 0,
  "revisionComment": "first connection config",
  "archived": false,
  "auth": {
    "authType": "oauth"
  },
  "request": {
    "requestType": "get",
    "connectionUrl": "https://mockserver-proxy-dev.boxever.com/sample/get/basicauth"
  },
  "exampleValue": "string",
  "inputMappings": [
    {
      "externalConnectionRef": "string",
      "label": "City0",
      "key": "city0",
      "type": "string",
      "exampleValue": "string",
      "mapping": "string"
    }
  ],
  "outputMappings": [
    {
      "externalConnectionRef": "8ad39f25-d75b-44b5-bcd0-b8f92ead9ba5",
      "label": "Success",
      "outputReference": "success",
      "type": "boolean"
    }
  ],
  "customHeaders": [
    {
      "externalConnectionRef": "8ad39f25-d75b-44b5-bcd0-b8f92ead9ba5",
      "name": "Accept",
      "value": "application/json"
    }
  ],
  "systemType": "DATA_SYSTEM",
  "connectionTimeout": 1000,
  "socketTimeout": 1000,
  "icon": "assets/images/icons/connections/predict-hq.png"
}