Chilkat Online Tools

PureBasic / Zoom API / Update a TSP account

Back to Collection Items

IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttpRequest.pb"

Procedure ChilkatExample()

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    req.i = CkHttpRequest::ckCreate()
    If req.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkHttpRequest::setCkHttpVerb(req, "PATCH")
    CkHttpRequest::setCkPath(req, "/v2/users/:userId/tsp/:tspId")
    CkHttpRequest::setCkContentType(req, "multipart/form-data")
    CkHttpRequest::ckAddParam(req,"conference_code","exercit")

    CkHttpRequest::ckAddParam(req,"leader_pin","exercitculpa")

    CkHttpRequest::ckAddParam(req,"dial_in_numbers","exercitculpa[{" + Chr(34) + "code" + Chr(34) + ":" + Chr(34) + "minim" + Chr(34) + "," + Chr(34) + "number" + Chr(34) + ":" + Chr(34) + "consequat " + Chr(34) + "," + Chr(34) + "type" + Chr(34) + ":" + Chr(34) + "toll" + Chr(34) + "," + Chr(34) + "country_label" + Chr(34) + ":" + Chr(34) + "Ut " + Chr(34) + "},{" + Chr(34) + "code" + Chr(34) + ":" + Chr(34) + "ut i" + Chr(34) + "," + Chr(34) + "number" + Chr(34) + ":" + Chr(34) + "mi" + Chr(34) + "," + Chr(34) + "type" + Chr(34) + ":" + Chr(34) + "media_link" + Chr(34) + "," + Chr(34) + "country_label" + Chr(34) + ":" + Chr(34) + "sed de" + Chr(34) + "}]")

    CkHttpRequest::ckAddParam(req,"tsp_bridge","exercitculpa[{" + Chr(34) + "code" + Chr(34) + ":" + Chr(34) + "minim" + Chr(34) + "," + Chr(34) + "number" + Chr(34) + ":" + Chr(34) + "consequat " + Chr(34) + "," + Chr(34) + "type" + Chr(34) + ":" + Chr(34) + "toll" + Chr(34) + "," + Chr(34) + "country_label" + Chr(34) + ":" + Chr(34) + "Ut " + Chr(34) + "},{" + Chr(34) + "code" + Chr(34) + ":" + Chr(34) + "ut i" + Chr(34) + "," + Chr(34) + "number" + Chr(34) + ":" + Chr(34) + "mi" + Chr(34) + "," + Chr(34) + "type" + Chr(34) + ":" + Chr(34) + "media_link" + Chr(34) + "," + Chr(34) + "country_label" + Chr(34) + ":" + Chr(34) + "sed de" + Chr(34) + "}]EU_TSP_TB")

    CkHttpRequest::ckAddHeader(req,"Authorization","Bearer <access_token>")

    resp.i = CkHttp::ckSynchronousRequest(http,"api.zoom.us",443,1,req)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkHttpRequest::ckDispose(req)
        ProcedureReturn
    EndIf

    respStatusCode.i = CkHttpResponse::ckStatusCode(resp)
    Debug "Response Status Code = " + Str(respStatusCode)
    If respStatusCode <> 204
        Debug "Response Header:"
        Debug CkHttpResponse::ckHeader(resp)
        Debug "Response Body:"
        Debug CkHttpResponse::ckBodyStr(resp)
        Debug "Failed."
        CkHttpResponse::ckDispose(resp)

        CkHttp::ckDispose(http)
        CkHttpRequest::ckDispose(req)
        ProcedureReturn
    EndIf

    CkHttpResponse::ckDispose(resp)

    Debug "Success."


    CkHttp::ckDispose(http)
    CkHttpRequest::ckDispose(req)


    ProcedureReturn
EndProcedure

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": ""
    }
  ]
}