Ruby / Zoom API / Add assistants
Back to Collection Items
require 'chilkat'
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
http = Chilkat::CkHttp.new()
req = Chilkat::CkHttpRequest.new()
req.put_HttpVerb("POST")
req.put_Path("/v2/users/:userId/assistants")
req.put_ContentType("multipart/form-data")
jsonFormData1 = Chilkat::CkJsonArray.new()
jsonFormData1.AddObjectAt(-1)
# jsonObj_1 is a CkJsonObject
jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.get_Size() - 1)
jsonObj_1.UpdateString("id","nisi ut aliqua")
jsonObj_1.UpdateString("email","anim")
jsonFormData1.AddObjectAt(-1)
# jsonObj_1 is a CkJsonObject
jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.get_Size() - 1)
jsonObj_1.UpdateString("id","anim ex labore proident")
jsonObj_1.UpdateString("email","tempor amet consectetur")
req.AddStringForUpload2("assistants","",jsonFormData1,"utf-8","application/json")
req.AddHeader("Authorization","Bearer <access_token>")
# resp is a CkHttpResponse
resp = http.SynchronousRequest("api.zoom.us",443,true,req)
if (http.get_LastMethodSuccess() == false)
print http.lastErrorText() + "\n";
exit
end
sbResponseBody = Chilkat::CkStringBuilder.new()
resp.GetBodySb(sbResponseBody)
jResp = Chilkat::CkJsonObject.new()
jResp.LoadSb(sbResponseBody)
jResp.put_EmitCompact(false)
print "Response Body:" + "\n";
print jResp.emit() + "\n";
respStatusCode = resp.get_StatusCode()
print "Response Status Code = " + respStatusCode.to_s() + "\n";
if (respStatusCode >= 400)
print "Response Header:" + "\n";
print resp.header() + "\n";
print "Failed." + "\n";
exit
end
# 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
ids = jResp.stringOf("ids")
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": ""
}
]
}