Chilkat Online Tools

Node.js / Zoom API / Update registration questions

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    var req = new chilkat.HttpRequest();
    req.HttpVerb = "PATCH";
    req.Path = "/v2/meetings/:meetingId/registrants/questions";
    req.ContentType = "multipart/form-data";

    var jsonFormData1 = new chilkat.JsonArray();

    jsonFormData1.AddObjectAt(-1);
    // jsonObj_1: JsonObject
    var jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1);
    jsonObj_1.UpdateString("field_name","address");
    jsonObj_1.UpdateBool("required",false);

    jsonFormData1.AddObjectAt(-1);
    jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1);
    jsonObj_1.UpdateString("field_name","phone");
    jsonObj_1.UpdateBool("required",false);

    req.AddParam("questions",jsonFormData1.Emit());

    var jsonFormData2 = new chilkat.JsonArray();

    jsonFormData2.AddObjectAt(-1);
    // jsonObj_1: JsonObject
    var jsonObj_1 = jsonFormData2.ObjectAt(jsonFormData2.Size - 1);
    jsonObj_1.UpdateString("field_name","address");
    jsonObj_1.UpdateBool("required",false);

    jsonFormData2.AddObjectAt(-1);
    jsonObj_1 = jsonFormData2.ObjectAt(jsonFormData2.Size - 1);
    jsonObj_1.UpdateString("field_name","phone");
    jsonObj_1.UpdateBool("required",false);

    req.AddParam("custom_questions",jsonFormData2.Emit());

    req.AddHeader("Authorization","Bearer <access_token>");

    // resp: HttpResponse
    var resp = http.SynchronousRequest("api.zoom.us",443,true,req);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    var respStatusCode = resp.StatusCode;
    console.log("Response Status Code = " + respStatusCode);
    if (respStatusCode !== 204) {
        console.log("Response Header:");
        console.log(resp.Header);
        console.log("Response Body:");
        console.log(resp.BodyStr);
        console.log("Failed.");

        return;
    }

    console.log("Success.");

}

chilkatExample();

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