SQL Server / Zoom API / Update registration questions
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @req int
-- Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.HttpRequest', @req OUT
EXEC sp_OASetProperty @req, 'HttpVerb', 'PATCH'
EXEC sp_OASetProperty @req, 'Path', '/v2/webinars/:webinarId/registrants/questions'
EXEC sp_OASetProperty @req, 'ContentType', 'multipart/form-data'
DECLARE @jsonFormData1 int
-- Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonArray', @jsonFormData1 OUT
EXEC sp_OAMethod @jsonFormData1, 'AddObjectAt', @success OUT, -1
DECLARE @jsonObj_1 int
EXEC sp_OAGetProperty @jsonFormData1, 'Size', @iTmp0 OUT
EXEC sp_OAMethod @jsonFormData1, 'ObjectAt', @jsonObj_1 OUT, @iTmp0 - 1
EXEC sp_OAMethod @jsonObj_1, 'UpdateString', @success OUT, 'field_name', 'org'
EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 1
EXEC @hr = sp_OADestroy @jsonObj_1
EXEC sp_OAMethod @jsonFormData1, 'AddObjectAt', @success OUT, -1
EXEC sp_OAGetProperty @jsonFormData1, 'Size', @iTmp0 OUT
EXEC sp_OAMethod @jsonFormData1, 'ObjectAt', @jsonObj_1 OUT, @iTmp0 - 1
EXEC sp_OAMethod @jsonObj_1, 'UpdateString', @success OUT, 'field_name', 'job_title'
EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
EXEC @hr = sp_OADestroy @jsonObj_1
EXEC sp_OAMethod @req, 'AddStringForUpload2', @success OUT, 'questions', '', @jsonFormData1, 'utf-8', 'application/json'
DECLARE @jsonFormData2 int
-- Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonArray', @jsonFormData2 OUT
EXEC sp_OAMethod @jsonFormData2, 'AddObjectAt', @success OUT, -1
DECLARE @jsonObj_1 int
EXEC sp_OAGetProperty @jsonFormData2, 'Size', @iTmp0 OUT
EXEC sp_OAMethod @jsonFormData2, 'ObjectAt', @jsonObj_1 OUT, @iTmp0 - 1
EXEC sp_OAMethod @jsonObj_1, 'UpdateString', @success OUT, 'field_name', 'org'
EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 1
EXEC @hr = sp_OADestroy @jsonObj_1
EXEC sp_OAMethod @jsonFormData2, 'AddObjectAt', @success OUT, -1
EXEC sp_OAGetProperty @jsonFormData2, 'Size', @iTmp0 OUT
EXEC sp_OAMethod @jsonFormData2, 'ObjectAt', @jsonObj_1 OUT, @iTmp0 - 1
EXEC sp_OAMethod @jsonObj_1, 'UpdateString', @success OUT, 'field_name', 'job_title'
EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
EXEC @hr = sp_OADestroy @jsonObj_1
EXEC sp_OAMethod @req, 'AddStringForUpload2', @success OUT, 'custom_questions', '', @jsonFormData2, 'utf-8', 'application/json'
EXEC sp_OAMethod @req, 'AddHeader', NULL, 'Authorization', 'Bearer <access_token>'
DECLARE @resp int
EXEC sp_OAMethod @http, 'SynchronousRequest', @resp OUT, 'api.zoom.us', 443, 1, @req
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @req
EXEC @hr = sp_OADestroy @jsonFormData1
EXEC @hr = sp_OADestroy @jsonFormData2
RETURN
END
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode <> 204
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Response Body:'
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @req
EXEC @hr = sp_OADestroy @jsonFormData1
EXEC @hr = sp_OADestroy @jsonFormData2
RETURN
END
EXEC @hr = sp_OADestroy @resp
PRINT 'Success.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @req
EXEC @hr = sp_OADestroy @jsonFormData1
EXEC @hr = sp_OADestroy @jsonFormData2
END
GO
Curl Command
curl -X PATCH
-H "Authorization: Bearer <access_token>"
-H "Content-Type: multipart/form-data"
--form 'questions=[{"field_name":"org","required":true},{"field_name":"job_title","required":false}]'
--form 'custom_questions=[{"field_name":"org","required":true},{"field_name":"job_title","required":false}][{"title":"","type":"single_dropdown","required":true,"answers":["culpa elit","tempor amet culpa nostrud ullamco"]},{"title":"est in incididunt occaecat","type":"short","required":true,"answers":["culpa nulla","laborum pariatur aliqua minim"]}]'
https://api.zoom.us/v2/webinars/:webinarId/registrants/questions
Postman Collection Item JSON
{
"name": "Update registration questions",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"org\",\"required\":true},{\"field_name\":\"job_title\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"\",\"type\":\"single_dropdown\",\"required\":true,\"answers\":[\"culpa elit\",\"tempor amet culpa nostrud ullamco\"]},{\"title\":\"est in incididunt occaecat\",\"type\":\"short\",\"required\":true,\"answers\":[\"culpa nulla\",\"laborum pariatur aliqua minim\"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"registrants",
"questions"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
},
"description": "Scheduling a [Webinar with registration](https://support.zoom.us/hc/en-us/articles/204619915-Scheduling-a-Webinar-with-Registration) requires your registrants to complete a brief form with fields and questions before they can receive the link to join the Webinar.<br>Use this API to update registration questions and fields of a scheduled Webinar that are to be answered by users while registering for a Webinar.<br><br>\n**Prerequisites:**<br> \n* Pro or higher plan with a Webinar Add-on.\n* Registration option for Webinar should be set as required to use this API. \n**Scopes:** `webinar:write:admin` `webinar:write`<br>\n \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`\n\n"
},
"response": [
{
"name": "**HTTP Status Code:** `204`<br>Webinar Registrant Questions Updated",
"originalRequest": {
"method": "PATCH",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"country\",\"required\":true},{\"field_name\":\"zip\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"commodo magna incididunt\",\"type\":\"short\",\"required\":true,\"answers\":[\"sunt eu\",\"exercitation nulla eiusmod Lorem\"]},{\"title\":\"aliqua cupidatat Excepteur sit\",\"type\":\"multiple\",\"required\":true,\"answers\":[\"do tempor \",\"in ut\"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"registrants",
"questions"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `404`<br>Webinar not found",
"originalRequest": {
"method": "PATCH",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"country\",\"required\":true},{\"field_name\":\"zip\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"commodo magna incididunt\",\"type\":\"short\",\"required\":true,\"answers\":[\"sunt eu\",\"exercitation nulla eiusmod Lorem\"]},{\"title\":\"aliqua cupidatat Excepteur sit\",\"type\":\"multiple\",\"required\":true,\"answers\":[\"do tempor \",\"in ut\"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/webinars/:webinarId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"webinars",
":webinarId",
"registrants",
"questions"
],
"variable": [
{
"key": "webinarId",
"value": "68423085",
"description": "(Required) The webinar's ID."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}