Chilkat Online Tools

Swift / Zoom API / Update a TSP account

Back to Collection Items

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

    let http = CkoHttp()
    var success: Bool

    let req = CkoHttpRequest()
    req.HttpVerb = "PATCH"
    req.Path = "/v2/users/:userId/tsp/:tspId"
    req.ContentType = "multipart/form-data"
    req.AddParam("conference_code", value: "exercit")

    req.AddParam("leader_pin", value: "exercitculpa")

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

    req.AddParam("tsp_bridge", value: "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")

    req.AddHeader("Authorization", value: "Bearer <access_token>")

    var resp: CkoHttpResponse? = http.SynchronousRequest("api.zoom.us", port: 443, ssl: true, req: req)
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    var respStatusCode: Int = resp!.StatusCode.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode != 204 {
        print("Response Header:")
        print("\(resp!.Header)")
        print("Response Body:")
        print("\(resp!.BodyStr)")
        print("Failed.")
        resp = nil
        return
    }

    resp = nil
    print("Success.")

}

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