Chilkat Online Tools

Powershell / Sunshine Conversations API / Delete Switchboard Integration

Back to Collection Items

Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = New-Object Chilkat.Http

$http.BasicAuth = $true
$http.Login = "username"
$http.Password = "password"

$resp = $http.QuickRequest("DELETE","https://domain.com/v2/apps/{{appId}}/switchboards/:switchboardId/switchboardIntegrations/:switchboardIntegrationId")
if ($http.LastMethodSuccess -eq $false) {
    $($http.LastErrorText)
    exit
}

$sbResponseBody = New-Object Chilkat.StringBuilder
$resp.GetBodySb($sbResponseBody)

$jResp = New-Object Chilkat.JsonObject
$jResp.LoadSb($sbResponseBody)
$jResp.EmitCompact = $false

$("Response Body:")
$($jResp.Emit())

$respStatusCode = $resp.StatusCode
$("Response Status Code = " + $respStatusCode)
if ($respStatusCode -ge 400) {
    $("Response Header:")
    $($resp.Header)
    $("Failed.")

    exit
}

Curl Command

curl -X DELETE
	-u 'username:password'
https://domain.com/v2/apps/{{appId}}/switchboards/:switchboardId/switchboardIntegrations/:switchboardIntegrationId

Postman Collection Item JSON

{
  "name": "Delete Switchboard Integration",
  "_postman_id": "b2a30338-7e4b-4ae6-ba47-fe1ccd3f6c5f",
  "request": {
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{url}}/v2/apps/{{appId}}/switchboards/:switchboardId/switchboardIntegrations/:switchboardIntegrationId",
      "host": [
        "{{url}}"
      ],
      "path": [
        "v2",
        "apps",
        "{{appId}}",
        "switchboards",
        ":switchboardId",
        "switchboardIntegrations",
        ":switchboardIntegrationId"
      ],
      "variable": [
        {
          "key": "switchboardId"
        },
        {
          "key": "switchboardIntegrationId"
        }
      ]
    },
    "description": "Deletes the switchboard integration. If the deleted switchboard integration had an active status for some conversations, the default switchboard integration will replace it. Note that it is forbidden to delete a switchboard integration if it's the default one (a new one must be chosen first) or if another switchboard integration's `nextSwitchboardIntegrationId` refers to it. The integration that was linked to the deleted switchboard integration will start receiving all conversation events, regardless of the switchboard status."
  },
  "response": [
    {
      "id": "3a8ec5f0-3d4f-4518-8d2c-e96ae790ba4a",
      "name": "Ok",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: bearer",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "Bearer <token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/v2/apps/:appId/switchboards/:switchboardId/switchboardIntegrations/:switchboardIntegrationId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "v2",
            "apps",
            ":appId",
            "switchboards",
            ":switchboardId",
            "switchboardIntegrations",
            ":switchboardIntegrationId"
          ],
          "variable": [
            {
              "key": "appId"
            },
            {
              "key": "switchboardId"
            },
            {
              "key": "switchboardIntegrationId"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "id": "3ae71b14-7244-4291-983a-cacad1311a7e",
      "name": "Not Found",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: bearer",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "Bearer <token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/v2/apps/:appId/switchboards/:switchboardId/switchboardIntegrations/:switchboardIntegrationId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "v2",
            "apps",
            ":appId",
            "switchboards",
            ":switchboardId",
            "switchboardIntegrations",
            ":switchboardIntegrationId"
          ],
          "variable": [
            {
              "key": "appId"
            },
            {
              "key": "switchboardId"
            },
            {
              "key": "switchboardIntegrationId"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}