Chilkat Online Tools

C / Zoom API / Update a TSP account

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkHttpRequest.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkHttpRequest req;
    HCkHttpResponse resp;
    int respStatusCode;

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

    http = CkHttp_Create();

    req = CkHttpRequest_Create();
    CkHttpRequest_putHttpVerb(req,"PATCH");
    CkHttpRequest_putPath(req,"/v2/users/:userId/tsp/:tspId");
    CkHttpRequest_putContentType(req,"multipart/form-data");
    CkHttpRequest_AddParam(req,"conference_code","exercit");

    CkHttpRequest_AddParam(req,"leader_pin","exercitculpa");

    CkHttpRequest_AddParam(req,"dial_in_numbers","exercitculpa[{\"code\":\"minim\",\"number\":\"consequat \",\"type\":\"toll\",\"country_label\":\"Ut \"},{\"code\":\"ut i\",\"number\":\"mi\",\"type\":\"media_link\",\"country_label\":\"sed de\"}]");

    CkHttpRequest_AddParam(req,"tsp_bridge","exercitculpa[{\"code\":\"minim\",\"number\":\"consequat \",\"type\":\"toll\",\"country_label\":\"Ut \"},{\"code\":\"ut i\",\"number\":\"mi\",\"type\":\"media_link\",\"country_label\":\"sed de\"}]EU_TSP_TB");

    CkHttpRequest_AddHeader(req,"Authorization","Bearer <access_token>");

    resp = CkHttp_SynchronousRequest(http,"api.zoom.us",443,TRUE,req);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        return;
    }

    respStatusCode = CkHttpResponse_getStatusCode(resp);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode != 204) {
        printf("Response Header:\n");
        printf("%s\n",CkHttpResponse_header(resp));
        printf("Response Body:\n");
        printf("%s\n",CkHttpResponse_bodyStr(resp));
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        return;
    }

    CkHttpResponse_Dispose(resp);
    printf("Success.\n");


    CkHttp_Dispose(http);
    CkHttpRequest_Dispose(req);

    }

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'conference_code=exercit'
	--form 'leader_pin=exercitculpa'
	--form 'dial_in_numbers=exercitculpa[{"code":"minim","number":"consequat ","type":"toll","country_label":"Ut "},{"code":"ut i","number":"mi","type":"media_link","country_label":"sed de"}]'
	--form 'tsp_bridge=exercitculpa[{"code":"minim","number":"consequat ","type":"toll","country_label":"Ut "},{"code":"ut i","number":"mi","type":"media_link","country_label":"sed de"}]EU_TSP_TB'
https://api.zoom.us/v2/users/:userId/tsp/:tspId

Postman Collection Item JSON

{
  "name": "Update a TSP account",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "conference_code",
          "value": "exercit",
          "description": "(Required) Conference code: numeric value, length is less than 16.",
          "type": "text"
        },
        {
          "key": "leader_pin",
          "value": "culpa",
          "description": "(Required) Leader PIN: numeric value, length is less than 16.",
          "type": "text"
        },
        {
          "key": "dial_in_numbers",
          "value": "[{\"code\":\"minim\",\"number\":\"consequat \",\"type\":\"toll\",\"country_label\":\"Ut \"},{\"code\":\"ut i\",\"number\":\"mi\",\"type\":\"media_link\",\"country_label\":\"sed de\"}]",
          "description": "List of dial in numbers.",
          "type": "text"
        },
        {
          "key": "tsp_bridge",
          "value": "EU_TSP_TB",
          "description": "Telephony bridge (This can only be one of US_TSP_TB,EU_TSP_TB)",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/users/:userId/tsp/:tspId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "users",
        ":userId",
        "tsp",
        ":tspId"
      ],
      "variable": [
        {
          "key": "userId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
        },
        {
          "key": "tspId",
          "value": "2",
          "description": "(Required) TSP account ID."
        }
      ]
    },
    "description": "Update a user's TSP account.<br><br>\n**Scopes:** `tsp:write:admin` `tsp:write`<br>\n \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:**`204` **No Content**<br>\nTSP account updated.",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "conference_code",
              "value": "incididunt",
              "description": "(Required) Conference code: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "leader_pin",
              "value": "nostrud offi",
              "description": "(Required) Leader PIN: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "dial_in_numbers",
              "value": "[{\"code\":\"anim \",\"number\":\"Exc\",\"type\":\"media_link\",\"country_label\":\"non q\"},{\"code\":\"do \",\"number\":\"aliquip nis\",\"type\":\"toll\",\"country_label\":\"aute o\"}]",
              "description": "List of dial in numbers.",
              "type": "text"
            },
            {
              "key": "tsp_bridge",
              "value": "EU_TSP_TB",
              "description": "Telephony bridge (This can only be one of US_TSP_TB,EU_TSP_TB)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/tsp/:tspId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "tsp",
            ":tspId"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            },
            {
              "key": "tspId",
              "value": "2",
              "description": "(Required) TSP account ID."
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `400`<br>\nBad request.<br>\n**Error Code:**`2024`<br>\nAccount has not enabled TSP.<br>\n**Error Code:**`300`<br>\nThe TSP id provided does not exist.<br>\n**Error Code:**`300`<br>\nTSP Config does not exist.<br>\n**Error Code:**`300`<br>\nA",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "conference_code",
              "value": "incididunt",
              "description": "(Required) Conference code: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "leader_pin",
              "value": "nostrud offi",
              "description": "(Required) Leader PIN: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "dial_in_numbers",
              "value": "[{\"code\":\"anim \",\"number\":\"Exc\",\"type\":\"media_link\",\"country_label\":\"non q\"},{\"code\":\"do \",\"number\":\"aliquip nis\",\"type\":\"toll\",\"country_label\":\"aute o\"}]",
              "description": "List of dial in numbers.",
              "type": "text"
            },
            {
              "key": "tsp_bridge",
              "value": "EU_TSP_TB",
              "description": "Telephony bridge (This can only be one of US_TSP_TB,EU_TSP_TB)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/tsp/:tspId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "tsp",
            ":tspId"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            },
            {
              "key": "tspId",
              "value": "2",
              "description": "(Required) TSP account ID."
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\nNot Found.<br>\n**Error Code:** `1001`<br>\nUser does not exist: $userId.<br>\n**Error Code:**`1120`<br>\nA valid invitation to join the Zoom account was not found for this user.<br>\nThis error is thrown if you added a user in ",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "conference_code",
              "value": "incididunt",
              "description": "(Required) Conference code: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "leader_pin",
              "value": "nostrud offi",
              "description": "(Required) Leader PIN: numeric value, length is less than 16.",
              "type": "text"
            },
            {
              "key": "dial_in_numbers",
              "value": "[{\"code\":\"anim \",\"number\":\"Exc\",\"type\":\"media_link\",\"country_label\":\"non q\"},{\"code\":\"do \",\"number\":\"aliquip nis\",\"type\":\"toll\",\"country_label\":\"aute o\"}]",
              "description": "List of dial in numbers.",
              "type": "text"
            },
            {
              "key": "tsp_bridge",
              "value": "EU_TSP_TB",
              "description": "Telephony bridge (This can only be one of US_TSP_TB,EU_TSP_TB)",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/tsp/:tspId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "tsp",
            ":tspId"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            },
            {
              "key": "tspId",
              "value": "2",
              "description": "(Required) TSP account ID."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}