Chilkat Online Tools

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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    DECLARE @req int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.HttpRequest', @req OUT

    EXEC sp_OASetProperty @req, 'HttpVerb', 'PATCH'
    EXEC sp_OASetProperty @req, 'Path', '/v2/meetings/:meetingId/registrants/questions'
    EXEC sp_OASetProperty @req, 'ContentType', 'multipart/form-data'

    DECLARE @jsonFormData1 int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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', 'address'
    EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
    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', 'phone'
    EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
    EXEC @hr = sp_OADestroy @jsonObj_1

    EXEC sp_OAMethod @jsonFormData1, 'Emit', @sTmp0 OUT
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'questions', @sTmp0

    DECLARE @jsonFormData2 int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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', 'address'
    EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
    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', 'phone'
    EXEC sp_OAMethod @jsonObj_1, 'UpdateBool', @success OUT, 'required', 0
    EXEC @hr = sp_OADestroy @jsonObj_1

    EXEC sp_OAMethod @jsonFormData2, 'Emit', @sTmp0 OUT
    EXEC sp_OAMethod @req, 'AddParam', NULL, 'custom_questions', @sTmp0

    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":"address","required":false},{"field_name":"phone","required":false}]'
	--form 'custom_questions=[{"field_name":"address","required":false},{"field_name":"phone","required":false}][{"title":"commodo","type":"single","required":true,"answers":["magna aute nostrud id proident","pariatur aliquip"]},{"title":"id nisi reprehenderit esse","type":"short","required":false,"answers":["amet pariatur Lorem ullamco","Ut cillum"]}]'
https://api.zoom.us/v2/meetings/:meetingId/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\":\"address\",\"required\":false},{\"field_name\":\"phone\",\"required\":false}]",
          "description": "undefined",
          "type": "text"
        },
        {
          "key": "custom_questions",
          "value": "[{\"title\":\"commodo\",\"type\":\"single\",\"required\":true,\"answers\":[\"magna aute nostrud id proident\",\"pariatur aliquip\"]},{\"title\":\"id nisi reprehenderit esse\",\"type\":\"short\",\"required\":false,\"answers\":[\"amet pariatur Lorem ullamco\",\"Ut cillum\"]}]",
          "description": "undefined",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "meetings",
        ":meetingId",
        "registrants",
        "questions"
      ],
      "variable": [
        {
          "key": "meetingId",
          "value": "68423085",
          "description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
        }
      ]
    },
    "description": "Update registration questions that will be displayed to users while [registering for a meeting](https://support.zoom.us/hc/en-us/articles/211579443-Registration-for-Meetings).<br><br>\n**Scopes:** `meeting:write`, `meeting:write:admin`<br>\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`\n \n\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `204`<br>\nMeeting 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\":\"comments\",\"required\":true},{\"field_name\":\"phone\",\"required\":false}]",
              "description": "undefined",
              "type": "text"
            },
            {
              "key": "custom_questions",
              "value": "[{\"title\":\"incididunt in\",\"type\":\"single\",\"required\":true,\"answers\":[\"voluptate labore\",\"deserunt \"]},{\"title\":\"fugia\",\"type\":\"short\",\"required\":false,\"answers\":[\"min\",\"dolore in sint \"]}]",
              "description": "undefined",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "registrants",
            "questions"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "68423085",
              "description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\nMeeting 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\":\"comments\",\"required\":true},{\"field_name\":\"phone\",\"required\":false}]",
              "description": "undefined",
              "type": "text"
            },
            {
              "key": "custom_questions",
              "value": "[{\"title\":\"incididunt in\",\"type\":\"single\",\"required\":true,\"answers\":[\"voluptate labore\",\"deserunt \"]},{\"title\":\"fugia\",\"type\":\"short\",\"required\":false,\"answers\":[\"min\",\"dolore in sint \"]}]",
              "description": "undefined",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "registrants",
            "questions"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "68423085",
              "description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}