VB6 / Zoom API / Add a user's TSP account
Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
Dim req As New ChilkatHttpRequest
req.HttpVerb = "POST"
req.Path = "/v2/users/:userId/tsp"
req.ContentType = "multipart/form-data"
req.AddParam "conference_code","dolore elit"
req.AddParam "leader_pin","dolore elitipsu"
req.AddParam "dial_in_numbers","dolore elitipsu[{""code"":""sin"",""number"":""voluptat"",""type"":""toll"",""country_label"":""in deserun""},{""code"":""a"",""number"":""ea pariatur in i"",""type"":""tollfree"",""country_label"":""""}]"
req.AddParam "tsp_bridge","dolore elitipsu[{""code"":""sin"",""number"":""voluptat"",""type"":""toll"",""country_label"":""in deserun""},{""code"":""a"",""number"":""ea pariatur in i"",""type"":""tollfree"",""country_label"":""""}]US_TSP_TB"
req.AddHeader "Authorization","Bearer <access_token>"
Dim resp As ChilkatHttpResponse
Set resp = http.SynchronousRequest("api.zoom.us",443,1,req)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Dim sbResponseBody As New ChilkatStringBuilder
success = resp.GetBodySb(sbResponseBody)
Dim jResp As New ChilkatJsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0
Debug.Print "Response Body:"
Debug.Print jResp.Emit()
Dim respStatusCode As Long
respStatusCode = resp.StatusCode
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
Debug.Print "Response Header:"
Debug.Print resp.Header
Debug.Print "Failed."
Exit Sub
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "conference_code": "0125",
' "leader_pin": "11189898",
' "tsp_bridge": "string",
' "dial_in_numbers": [
' {
' "code": "01",
' "number": "000000000",
' "type": "toll"
' }
' ]
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Dim code As String
Dim v_number As String
Dim v_type As String
Dim conference_code As String
conference_code = jResp.StringOf("conference_code")
Dim leader_pin As String
leader_pin = jResp.StringOf("leader_pin")
Dim tsp_bridge As String
tsp_bridge = jResp.StringOf("tsp_bridge")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("dial_in_numbers")
Do While i < count_i
jResp.I = i
code = jResp.StringOf("dial_in_numbers[i].code")
v_number = jResp.StringOf("dial_in_numbers[i].number")
v_type = jResp.StringOf("dial_in_numbers[i].type")
i = i + 1
Loop
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: multipart/form-data"
--form 'conference_code=dolore elit'
--form 'leader_pin=dolore elitipsu'
--form 'dial_in_numbers=dolore elitipsu[{"code":"sin","number":"voluptat","type":"toll","country_label":"in deserun"},{"code":"a","number":"ea pariatur in i","type":"tollfree","country_label":""}]'
--form 'tsp_bridge=dolore elitipsu[{"code":"sin","number":"voluptat","type":"toll","country_label":"in deserun"},{"code":"a","number":"ea pariatur in i","type":"tollfree","country_label":""}]US_TSP_TB'
https://api.zoom.us/v2/users/:userId/tsp
Postman Collection Item JSON
{
"name": "Add a user's TSP account",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "conference_code",
"value": "dolore elit ",
"description": "(Required) Conference code: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "leader_pin",
"value": "ipsu",
"description": "(Required) Leader PIN: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "dial_in_numbers",
"value": "[{\"code\":\"sin\",\"number\":\"voluptat\",\"type\":\"toll\",\"country_label\":\"in deserun\"},{\"code\":\"a\",\"number\":\"ea pariatur in i\",\"type\":\"tollfree\",\"country_label\":\"\"}]",
"description": "List of dial in numbers.",
"type": "text"
},
{
"key": "tsp_bridge",
"value": "US_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",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"tsp"
],
"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."
}
]
},
"description": "Add 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:** `201`<br>\nTSP account added.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "conference_code",
"value": "ipsum ullamco",
"description": "(Required) Conference code: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "leader_pin",
"value": "esse do",
"description": "(Required) Leader PIN: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "dial_in_numbers",
"value": "[{\"code\":\"proi\",\"number\":\"aute\",\"type\":\"media_link\",\"country_label\":\"id in ea e\"},{\"code\":\"q\",\"number\":\"vol\",\"type\":\"toll\",\"country_label\":\"amet par\"}]",
"description": "List of dial in numbers.",
"type": "text"
},
{
"key": "tsp_bridge",
"value": "US_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",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"tsp"
],
"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."
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"conference_code\": \"0125\",\n \"leader_pin\": \"11189898\",\n \"tsp_bridge\": \"string\",\n \"dial_in_numbers\": [\n {\n \"code\": \"01\",\n \"number\": \"000000000\",\n \"type\": \"toll\"\n }\n ]\n}"
},
{
"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>\nMedia link is required for AT&T TSP accounts.<br>\n**Error Code:** `300`<br>\nYou can add a max of two tsp configs.\n",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "conference_code",
"value": "ipsum ullamco",
"description": "(Required) Conference code: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "leader_pin",
"value": "esse do",
"description": "(Required) Leader PIN: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "dial_in_numbers",
"value": "[{\"code\":\"proi\",\"number\":\"aute\",\"type\":\"media_link\",\"country_label\":\"id in ea e\"},{\"code\":\"q\",\"number\":\"vol\",\"type\":\"toll\",\"country_label\":\"amet par\"}]",
"description": "List of dial in numbers.",
"type": "text"
},
{
"key": "tsp_bridge",
"value": "US_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",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"tsp"
],
"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."
}
]
}
},
"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": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "conference_code",
"value": "ipsum ullamco",
"description": "(Required) Conference code: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "leader_pin",
"value": "esse do",
"description": "(Required) Leader PIN: numeric value, length is less than 16.",
"type": "text"
},
{
"key": "dial_in_numbers",
"value": "[{\"code\":\"proi\",\"number\":\"aute\",\"type\":\"media_link\",\"country_label\":\"id in ea e\"},{\"code\":\"q\",\"number\":\"vol\",\"type\":\"toll\",\"country_label\":\"amet par\"}]",
"description": "List of dial in numbers.",
"type": "text"
},
{
"key": "tsp_bridge",
"value": "US_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",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"tsp"
],
"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."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}