Chilkat Online Tools

DataFlex / Zoom API / Update registration questions

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vReq
    Handle hoReq
    Handle hoJsonFormData1
    Variant vJsonObj_1
    Handle hoJsonObj_1
    Handle hoJsonFormData2
    Variant vJsonObj_1
    Handle hoJsonObj_1
    Variant vResp
    Handle hoResp
    Integer iRespStatusCode
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatHttpRequest)) To hoReq
    If (Not(IsComObjectCreated(hoReq))) Begin
        Send CreateComObject of hoReq
    End
    Set ComHttpVerb Of hoReq To "PATCH"
    Set ComPath Of hoReq To "/v2/webinars/:webinarId/registrants/questions"
    Set ComContentType Of hoReq To "multipart/form-data"

    Get Create (RefClass(cComChilkatJsonArray)) To hoJsonFormData1
    If (Not(IsComObjectCreated(hoJsonFormData1))) Begin
        Send CreateComObject of hoJsonFormData1
    End

    Get ComAddObjectAt Of hoJsonFormData1 -1 To iSuccess
    Get ComSize Of hoJsonFormData1 To iTemp1
    Get ComObjectAt Of hoJsonFormData1 (iTemp1 - 1) To vJsonObj_1
    If (IsComObject(vJsonObj_1)) Begin
        Get Create (RefClass(cComChilkatJsonObject)) To hoJsonObj_1
        Set pvComObject Of hoJsonObj_1 To vJsonObj_1
    End
    Get ComUpdateString Of hoJsonObj_1 "field_name" "org" To iSuccess
    Get ComUpdateBool Of hoJsonObj_1 "required" True To iSuccess
    Send Destroy of hoJsonObj_1

    Get ComAddObjectAt Of hoJsonFormData1 -1 To iSuccess
    Get ComSize Of hoJsonFormData1 To iTemp1
    Get ComObjectAt Of hoJsonFormData1 (iTemp1 - 1) To vJsonObj_1
    If (IsComObject(vJsonObj_1)) Begin
        Get Create (RefClass(cComChilkatJsonObject)) To hoJsonObj_1
        Set pvComObject Of hoJsonObj_1 To vJsonObj_1
    End
    Get ComUpdateString Of hoJsonObj_1 "field_name" "job_title" To iSuccess
    Get ComUpdateBool Of hoJsonObj_1 "required" False To iSuccess
    Send Destroy of hoJsonObj_1

    Get ComEmit Of hoJsonFormData1 To sTemp1
    Send ComAddParam To hoReq "questions" sTemp1

    Get Create (RefClass(cComChilkatJsonArray)) To hoJsonFormData2
    If (Not(IsComObjectCreated(hoJsonFormData2))) Begin
        Send CreateComObject of hoJsonFormData2
    End

    Get ComAddObjectAt Of hoJsonFormData2 -1 To iSuccess
    Get ComSize Of hoJsonFormData2 To iTemp1
    Get ComObjectAt Of hoJsonFormData2 (iTemp1 - 1) To vJsonObj_1
    If (IsComObject(vJsonObj_1)) Begin
        Get Create (RefClass(cComChilkatJsonObject)) To hoJsonObj_1
        Set pvComObject Of hoJsonObj_1 To vJsonObj_1
    End
    Get ComUpdateString Of hoJsonObj_1 "field_name" "org" To iSuccess
    Get ComUpdateBool Of hoJsonObj_1 "required" True To iSuccess
    Send Destroy of hoJsonObj_1

    Get ComAddObjectAt Of hoJsonFormData2 -1 To iSuccess
    Get ComSize Of hoJsonFormData2 To iTemp1
    Get ComObjectAt Of hoJsonFormData2 (iTemp1 - 1) To vJsonObj_1
    If (IsComObject(vJsonObj_1)) Begin
        Get Create (RefClass(cComChilkatJsonObject)) To hoJsonObj_1
        Set pvComObject Of hoJsonObj_1 To vJsonObj_1
    End
    Get ComUpdateString Of hoJsonObj_1 "field_name" "job_title" To iSuccess
    Get ComUpdateBool Of hoJsonObj_1 "required" False To iSuccess
    Send Destroy of hoJsonObj_1

    Get ComEmit Of hoJsonFormData2 To sTemp1
    Send ComAddParam To hoReq "custom_questions" sTemp1

    Send ComAddHeader To hoReq "Authorization" "Bearer <access_token>"

    Get pvComObject of hoReq to vReq
    Get ComSynchronousRequest Of hoHttp "api.zoom.us" 443 True vReq To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode <> 204) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Response Body:"
        Get ComBodyStr Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp
    Showln "Success."


End_Procedure

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": ""
    }
  ]
}