VB6 / Zoom API / Add assistants
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/assistants"
req.ContentType = "multipart/form-data"
Dim jsonFormData1 As New ChilkatJsonArray
success = jsonFormData1.AddObjectAt(-1)
Dim jsonObj_1 As ChilkatJsonObject
Set jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1)
success = jsonObj_1.UpdateString("id","nisi ut aliqua")
success = jsonObj_1.UpdateString("email","anim")
success = jsonFormData1.AddObjectAt(-1)
Set jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1)
success = jsonObj_1.UpdateString("id","anim ex labore proident")
success = jsonObj_1.UpdateString("email","tempor amet consectetur")
success = req.AddStringForUpload2("assistants","",jsonFormData1,"utf-8","application/json")
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)
' {
' "ids": "string",
' "add_at": "string [date-time]"
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Dim ids As String
ids = jResp.StringOf("ids")
Dim add_at As String
add_at = jResp.StringOf("add_at")
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: multipart/form-data"
--form 'assistants=[{"id":"nisi ut aliqua","email":"anim"},{"id":"anim ex labore proident","email":"tempor amet consectetur"}]'
https://api.zoom.us/v2/users/:userId/assistants
Postman Collection Item JSON
{
"name": "Add assistants",
"request": {
"auth": {
"type": "oauth2"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "assistants",
"value": "[{\"id\":\"nisi ut aliqua\",\"email\":\"anim\"},{\"id\":\"anim ex labore proident\",\"email\":\"tempor amet consectetur\"}]",
"description": "List of User's assistants.",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/users/:userId/assistants",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"assistants"
],
"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": "Use this API to assign assistants to a user. In the request body, provide either the user's ID or the user's email address. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter. \n\n Assistants are users to whom the current user has assigned the [scheduling privilege](https://support.zoom.us/hc/en-us/articles/201362803-Scheduling-Privilege). These assistants can schedule meetings on behalf of the current user. Assistants can also manage and act as an alternative host for the user's meetings if the administrator has enabled the [co-host feature](https://support.zoom.us/hc/en-us/articles/206330935-Enabling-and-adding-a-co-host) on the account.\n\n**Scopes:** `user:write:admin`, `user:write` </br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium` \n\n**Prerequisites:** \n* The user and the assistant must have a Licensed or an On-prem license. \n* Assistants must be under the current user's account or in the same organization with the current user's account."
},
"response": [
{
"name": "**HTTP Status Code:** `201`<br>\nAssistant added.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "assistants",
"value": "[{\"id\":\"in nulla consequat\",\"email\":\"tempor ullamco occaecat et\"},{\"id\":\"nostrud incididunt et nisi\",\"email\":\"aute Excepteur laborum aliquip magna\"}]",
"description": "List of User's assistants.",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/users/:userId/assistants",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"assistants"
],
"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-Location",
"value": "quis officia in reprehenderit",
"description": "Location of created assistant"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"ids\": \"string\",\n \"add_at\": \"string [date-time]\"\n}"
},
{
"name": "**HTTP Status Code:** `400` **Bad Request**<br><br>\n**Error Code:** `200`<br>\nCurrent account must be paid account: $userId <br>\nThe user must either be a Licensed user or an On-prem user : $userId. <br>\nCan't assign scheduling privilege to yourself.<br>\n",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "assistants",
"value": "[{\"id\":\"in nulla consequat\",\"email\":\"tempor ullamco occaecat et\"},{\"id\":\"nostrud incididunt et nisi\",\"email\":\"aute Excepteur laborum aliquip magna\"}]",
"description": "List of User's assistants.",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/users/:userId/assistants",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"assistants"
],
"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` **Not Found**<br>\n**Error Code:** `1001`<br>\nUser does not exist: $userId.<br>",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "assistants",
"value": "[{\"id\":\"in nulla consequat\",\"email\":\"tempor ullamco occaecat et\"},{\"id\":\"nostrud incididunt et nisi\",\"email\":\"aute Excepteur laborum aliquip magna\"}]",
"description": "List of User's assistants.",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/users/:userId/assistants",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userId",
"assistants"
],
"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": ""
}
]
}