Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.

new Http http;
ckbool success;

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

new JsonArray jsonFormData1;

ignore = jsonFormData1.AddObjectAt(-1);
JsonObject jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1);
ignore = jsonObj_1.UpdateString("field_name","industry");
ignore = jsonObj_1.UpdateBool("required",ckfalse);
delete jsonObj_1;


ignore = jsonFormData1.AddObjectAt(-1);
jsonObj_1 = jsonFormData1.ObjectAt(jsonFormData1.Size - 1);
ignore = jsonObj_1.UpdateString("field_name","org");
ignore = jsonObj_1.UpdateBool("required",ckfalse);
delete jsonObj_1;

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


new JsonArray jsonFormData2;

ignore = jsonFormData2.AddObjectAt(-1);
JsonObject jsonObj_1 = jsonFormData2.ObjectAt(jsonFormData2.Size - 1);
ignore = jsonObj_1.UpdateString("field_name","industry");
ignore = jsonObj_1.UpdateBool("required",ckfalse);
delete jsonObj_1;


ignore = jsonFormData2.AddObjectAt(-1);
jsonObj_1 = jsonFormData2.ObjectAt(jsonFormData2.Size - 1);
ignore = jsonObj_1.UpdateString("field_name","org");
ignore = jsonObj_1.UpdateBool("required",ckfalse);
delete jsonObj_1;

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

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

HttpResponse resp = http.SynchronousRequest("api.zoom.us",443,cktrue ,req);
if (http.LastMethodSuccess == ckfalse) {
    println http.LastErrorText;
    return;
}

int respStatusCode = resp.StatusCode;
println "Response Status Code = ",respStatusCode;
if (respStatusCode != 204) {
    println "Response Header:";
    println resp.Header;
    println "Response Body:";
    println resp.BodyStr;
    println "Failed.";
    delete resp;
    return;
}
delete resp;
println "Success.";

---- end chilkat script ----

delphiDll / Zoom API / Update registration questions

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
req: HCkHttpRequest;
jsonFormData1: HCkJsonArray;
jsonObj_1: HCkJsonObject;
jsonFormData2: HCkJsonArray;
jsonObj_1: HCkJsonObject;
resp: HCkHttpResponse;
respStatusCode: Integer;

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

http := CkHttp_Create();

req := CkHttpRequest_Create();
CkHttpRequest_putHttpVerb(req,'PATCH');
CkHttpRequest_putPath(req,'/v2/meetings/:meetingId/recordings/registrants/questions');
CkHttpRequest_putContentType(req,'multipart/form-data');

jsonFormData1 := CkJsonArray_Create();

CkJsonArray_AddObjectAt(jsonFormData1,-1);
jsonObj_1 := CkJsonArray_ObjectAt(jsonFormData1,CkJsonArray_getSize(jsonFormData1) - 1);
CkJsonObject_UpdateString(jsonObj_1,'field_name','industry');
CkJsonObject_UpdateBool(jsonObj_1,'required',False);
CkJsonObject_Dispose(jsonObj_1);

CkJsonArray_AddObjectAt(jsonFormData1,-1);
jsonObj_1 := CkJsonArray_ObjectAt(jsonFormData1,CkJsonArray_getSize(jsonFormData1) - 1);
CkJsonObject_UpdateString(jsonObj_1,'field_name','org');
CkJsonObject_UpdateBool(jsonObj_1,'required',False);
CkJsonObject_Dispose(jsonObj_1);

CkHttpRequest_AddParam(req,'questions',CkJsonArray__emit(jsonFormData1));

jsonFormData2 := CkJsonArray_Create();

CkJsonArray_AddObjectAt(jsonFormData2,-1);
jsonObj_1 := CkJsonArray_ObjectAt(jsonFormData2,CkJsonArray_getSize(jsonFormData2) - 1);ERROR: Var already declared: jsonObj_1

CkJsonObject_UpdateString(jsonObj_1,'field_name','industry');
CkJsonObject_UpdateBool(jsonObj_1,'required',False);
CkJsonObject_Dispose(jsonObj_1);

CkJsonArray_AddObjectAt(jsonFormData2,-1);
jsonObj_1 := CkJsonArray_ObjectAt(jsonFormData2,CkJsonArray_getSize(jsonFormData2) - 1);
CkJsonObject_UpdateString(jsonObj_1,'field_name','org');
CkJsonObject_UpdateBool(jsonObj_1,'required',False);
CkJsonObject_Dispose(jsonObj_1);

CkHttpRequest_AddParam(req,'custom_questions',CkJsonArray__emit(jsonFormData2));

CkHttpRequest_AddHeader(req,'Authorization','Bearer <access_token>');

resp := CkHttp_SynchronousRequest(http,'api.zoom.us',443,True,req);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode <> 204) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttpResponse__header(resp));
    Memo1.Lines.Add('Response Body:');
    Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
    Memo1.Lines.Add('Failed.');
    CkHttpResponse_Dispose(resp);
    Exit;
  end;
CkHttpResponse_Dispose(resp);
Memo1.Lines.Add('Success.');

CkHttp_Dispose(http);
CkHttpRequest_Dispose(req);
CkJsonArray_Dispose(jsonFormData1);
CkJsonArray_Dispose(jsonFormData2);

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'questions=[{"field_name":"industry","required":false},{"field_name":"org","required":false}]'
	--form 'custom_questions=[{"field_name":"industry","required":false},{"field_name":"org","required":false}][{"title":"Ut elit voluptate officia","type":"short","required":true,"answers":["amet in aliquip proident","occaecat eu ut laboris esse"]},{"title":"in nisi","type":"single","required":true,"answers":["anim est","Excepteur reprehenderit sit est"]}]'
https://api.zoom.us/v2/meetings/:meetingId/recordings/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\":\"industry\",\"required\":false},{\"field_name\":\"org\",\"required\":false}]",
          "description": "undefined",
          "type": "text"
        },
        {
          "key": "custom_questions",
          "value": "[{\"title\":\"Ut elit voluptate officia\",\"type\":\"short\",\"required\":true,\"answers\":[\"amet in aliquip proident\",\"occaecat eu ut laboris esse\"]},{\"title\":\"in nisi\",\"type\":\"single\",\"required\":true,\"answers\":[\"anim est\",\"Excepteur reprehenderit sit est\"]}]",
          "description": "undefined",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/meetings/:meetingId/recordings/registrants/questions",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "meetings",
        ":meetingId",
        "recordings",
        "registrants",
        "questions"
      ],
      "variable": [
        {
          "key": "meetingId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) To get Cloud Recordings of a meeting, provide the meeting ID or meeting UUID. If the meeting ID is provided instead of UUID,the response will be for the latest meeting instance. \n\nTo get Cloud Recordings of a webinar, provide the webinar ID or the webinar UUID. If the webinar ID is provided instead of UUID,the response will be for the latest webinar instance. \n\nIf a UUID starts with \"/\" or contains \"//\" (example: \"/ajXp112QmuoKj4854875==\"), you must **double encode** the UUID before making an API request. "
        }
      ]
    },
    "description": "For [on-demand](https://support.zoom.us/hc/en-us/articles/360000488283-On-demand-Recordings) meeting recordings, you can include fields with questions that will be shown to registrants when they register to view the recording.\n\nUse this API to update registration questions that are to be answered by users while registering to view a recording.<br>\n**Scopes:** `recording:write:admin`, `recording:write`<br> \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`<br>\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nRecording 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\":\"phone\",\"required\":true},{\"field_name\":\"country\",\"required\":true}]",
              "description": "undefined",
              "type": "text"
            },
            {
              "key": "custom_questions",
              "value": "[{\"title\":\"do laboris cupidatat dolor\",\"type\":\"single\",\"required\":true,\"answers\":[\"commodo aliquip sint incididunt\",\"deserunt dolore non Du\"]},{\"title\":\"commodo aliquip\",\"type\":\"single\",\"required\":false,\"answers\":[\"do magna laborum cillum\",\"veniam reprehenderit\"]}]",
              "description": "undefined",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/recordings/registrants/questions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "recordings",
            "registrants",
            "questions"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) To get Cloud Recordings of a meeting, provide the meeting ID or meeting UUID. If the meeting ID is provided instead of UUID,the response will be for the latest meeting instance. \n\nTo get Cloud Recordings of a webinar, provide the webinar ID or the webinar UUID. If the webinar ID is provided instead of UUID,the response will be for the latest webinar instance. \n\nIf a UUID starts with \"/\" or contains \"//\" (example: \"/ajXp112QmuoKj4854875==\"), you must **double encode** the UUID before making an API request. "
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\nMeeting recording or Registrant 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\":\"phone\",\"required\":true},{\"field_name\":\"country\",\"required\":true}]",
              "description": "undefined",
              "type": "text"
            },
            {
              "key": "custom_questions",
              "value": "[{\"title\":\"do laboris cupidatat dolor\",\"type\":\"single\",\"required\":true,\"answers\":[\"commodo aliquip sint incididunt\",\"deserunt dolore non Du\"]},{\"title\":\"commodo aliquip\",\"type\":\"single\",\"required\":false,\"answers\":[\"do magna laborum cillum\",\"veniam reprehenderit\"]}]",
              "description": "undefined",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/recordings/registrants/questions",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "recordings",
            "registrants",
            "questions"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) To get Cloud Recordings of a meeting, provide the meeting ID or meeting UUID. If the meeting ID is provided instead of UUID,the response will be for the latest meeting instance. \n\nTo get Cloud Recordings of a webinar, provide the webinar ID or the webinar UUID. If the webinar ID is provided instead of UUID,the response will be for the latest webinar instance. \n\nIf a UUID starts with \"/\" or contains \"//\" (example: \"/ajXp112QmuoKj4854875==\"), you must **double encode** the UUID before making an API request. "
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}