Chilkat Online Tools

C / Zoom API / Perform batch registration

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkHttpRequest.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkHttpRequest req;
    HCkHttpResponse resp;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;
    const char *registrant_id;
    const char *email;
    const char *join_url;
    int i;
    int count_i;

    // 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,"POST");
    CkHttpRequest_putPath(req,"/v2/meetings/:meetingId/batch_registrants");
    CkHttpRequest_putContentType(req,"multipart/form-data");
    CkHttpRequest_AddParam(req,"auto_approve","true");

    CkHttpRequest_AddParam(req,"registrants","true[{\"first_name\":\"dolore eu aute dolor\",\"email\":\"KEESPCs-T1pF@ljUbrzdNgzMc.xx\",\"last_name\":\"eu reprehenderit ea magna ex\"},{\"first_name\":\"aliquip deserunt\",\"email\":\"okZ9KNk@nZOovoEvyoTCgW.eftt\",\"last_name\":\"nostrud\"}]");

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

    resp = CkHttp_SynchronousRequest(http,"api.zoom.us",443,TRUE,req);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        return;
    }

    sbResponseBody = CkStringBuilder_Create();
    CkHttpResponse_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);

    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));

    respStatusCode = CkHttpResponse_getStatusCode(resp);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttpResponse_header(resp));
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    CkHttpResponse_Dispose(resp);

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "registrants": [
    //     {
    //       "registrant_id": "conseret14re",
    //       "email": "example@example.com",
    //       "join_url": " https://zoom.us/w/9999999?tk=oZuwHfdgAAAAAAAAAAAAAAAA&uuid=WN_XW4_SdxBBBBxLDQt"
    //     },
    //     {
    //       "registrant_id": "fdgsfh2ey82fuh",
    //       "email": "example-2@example.com",
    //       "join_url": " https://zoom.us/w/9999999?tk=oZu52542356AAAAAA&uuid=WN_XW4_SdxBBBBxLDQt"
    //     },
    //     {
    //       "registrant_id": "hdsfhjf3iwh",
    //       "email": "example-3@example.com",
    //       "join_url": " https://zoom.us/w/9999999?tk=ozghdfdsghf36AAA&uuid=WN_XW4_SdxBBBBxLDQt"
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"registrants");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        registrant_id = CkJsonObject_stringOf(jResp,"registrants[i].registrant_id");
        email = CkJsonObject_stringOf(jResp,"registrants[i].email");
        join_url = CkJsonObject_stringOf(jResp,"registrants[i].join_url");
        i = i + 1;
    }



    CkHttp_Dispose(http);
    CkHttpRequest_Dispose(req);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'auto_approve=true'
	--form 'registrants=true[{"first_name":"dolore eu aute dolor","email":"KEESPCs-T1pF@ljUbrzdNgzMc.xx","last_name":"eu reprehenderit ea magna ex"},{"first_name":"aliquip deserunt","email":"okZ9KNk@nZOovoEvyoTCgW.eftt","last_name":"nostrud"}]'
https://api.zoom.us/v2/meetings/:meetingId/batch_registrants

Postman Collection Item JSON

{
  "name": "Perform batch registration",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "auto_approve",
          "value": "true",
          "description": "If a meeting was scheduled with approval_type `1` (manual approval), but you would like to automatically approve the registrants that are added via this API, you can set the value of this field to `true`. \n\nYou **cannot** use this field to change approval setting for a meeting  that was originally scheduled with approval_type `0` (automatic approval).",
          "type": "text"
        },
        {
          "key": "registrants",
          "value": "[{\"first_name\":\"dolore eu aute dolor\",\"email\":\"KEESPCs-T1pF@ljUbrzdNgzMc.xx\",\"last_name\":\"eu reprehenderit ea magna ex\"},{\"first_name\":\"aliquip deserunt\",\"email\":\"okZ9KNk@nZOovoEvyoTCgW.eftt\",\"last_name\":\"nostrud\"}]",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/meetings/:meetingId/batch_registrants",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "meetings",
        ":meetingId",
        "batch_registrants"
      ],
      "variable": [
        {
          "key": "meetingId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) Unique identifier of the meeting (Meeting Number)."
        }
      ]
    },
    "description": "Register up to 30 registrants at once for a meeting that requires [registration](https://support.zoom.us/hc/en-us/articles/211579443-Registration-for-Meetings). <br>\n\n**Prerequisites:**<br>\n* The meeting host must be a Licensed user.\n* The meeting must require registration and should be of type `2`, i.e., they should be scheduled meetings. Instant meetings and Recurring meetings are not supported by this API.<br><br>\n**Scope:** `meeting:write`, `meeting:write:admin`<br>\n**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy`<br>\n\n\n\n\n\n\n\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200` **OK** <br>\nRegistrants added.",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "auto_approve",
              "value": "false",
              "description": "If a meeting was scheduled with approval_type `1` (manual approval), but you would like to automatically approve the registrants that are added via this API, you can set the value of this field to `true`. \n\nYou **cannot** use this field to change approval setting for a meeting  that was originally scheduled with approval_type `0` (automatic approval).",
              "type": "text"
            },
            {
              "key": "registrants",
              "value": "[{\"first_name\":\"dolore est dolore ex\",\"email\":\"QlxiFO3fdQ@rzgNRxcC.ijep\",\"last_name\":\"enim consequat veniam commodo\"},{\"first_name\":\"in ut proident adipisicing\",\"email\":\"Fk39rzyimgL2P@MAuNNuZMsxZfijeyYnVHAVxkQ.ipd\",\"last_name\":\"incididunt esse mollit ullamco est\"}]",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/batch_registrants",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "batch_registrants"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Unique identifier of the meeting (Meeting Number)."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"registrants\": [\n  {\n   \"registrant_id\": \"conseret14re\",\n   \"email\": \"example@example.com\",\n   \"join_url\": \" https://zoom.us/w/9999999?tk=oZuwHfdgAAAAAAAAAAAAAAAA&uuid=WN_XW4_SdxBBBBxLDQt\"\n  },\n  {\n   \"registrant_id\": \"fdgsfh2ey82fuh\",\n   \"email\": \"example-2@example.com\",\n   \"join_url\": \" https://zoom.us/w/9999999?tk=oZu52542356AAAAAA&uuid=WN_XW4_SdxBBBBxLDQt\"\n  },\n  {\n   \"registrant_id\": \"hdsfhjf3iwh\",\n   \"email\": \"example-3@example.com\",\n   \"join_url\": \" https://zoom.us/w/9999999?tk=ozghdfdsghf36AAA&uuid=WN_XW4_SdxBBBBxLDQt\"\n  }\n ]\n}"
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad Request** <br>\n**Error Code:** `3038`<br>\nMeeting is over, you can not register now. If you have any questions, please contact the Meeting host.<br><br>\n**Error Code:** `303`<br> \nThis API can only be used for scheduled m",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "auto_approve",
              "value": "false",
              "description": "If a meeting was scheduled with approval_type `1` (manual approval), but you would like to automatically approve the registrants that are added via this API, you can set the value of this field to `true`. \n\nYou **cannot** use this field to change approval setting for a meeting  that was originally scheduled with approval_type `0` (automatic approval).",
              "type": "text"
            },
            {
              "key": "registrants",
              "value": "[{\"first_name\":\"dolore est dolore ex\",\"email\":\"QlxiFO3fdQ@rzgNRxcC.ijep\",\"last_name\":\"enim consequat veniam commodo\"},{\"first_name\":\"in ut proident adipisicing\",\"email\":\"Fk39rzyimgL2P@MAuNNuZMsxZfijeyYnVHAVxkQ.ipd\",\"last_name\":\"incididunt esse mollit ullamco est\"}]",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/batch_registrants",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "batch_registrants"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Unique identifier of the meeting (Meeting Number)."
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404` **Not Found** <br>\n**Error Code:** `3001`<br>\nMeeting does not exist: {meetingId}.<br>\n**Error Code:** `3043`<br>\nMeeting has reached maximum attendee capacity.<br>\n**Error Code:** `404`<br>\nRegistration has not been enabled fo",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "auto_approve",
              "value": "false",
              "description": "If a meeting was scheduled with approval_type `1` (manual approval), but you would like to automatically approve the registrants that are added via this API, you can set the value of this field to `true`. \n\nYou **cannot** use this field to change approval setting for a meeting  that was originally scheduled with approval_type `0` (automatic approval).",
              "type": "text"
            },
            {
              "key": "registrants",
              "value": "[{\"first_name\":\"dolore est dolore ex\",\"email\":\"QlxiFO3fdQ@rzgNRxcC.ijep\",\"last_name\":\"enim consequat veniam commodo\"},{\"first_name\":\"in ut proident adipisicing\",\"email\":\"Fk39rzyimgL2P@MAuNNuZMsxZfijeyYnVHAVxkQ.ipd\",\"last_name\":\"incididunt esse mollit ullamco est\"}]",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/batch_registrants",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "batch_registrants"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Unique identifier of the meeting (Meeting Number)."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `429` <br> You have exceeded the daily rate limit of \"{0}\" for meeting **Perform batch registration** API requests for the registrant \"{1}\". You can resume these API requests at GMT 00:00:00.",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "auto_approve",
              "value": "false",
              "description": "If a meeting was scheduled with approval_type `1` (manual approval), but you would like to automatically approve the registrants that are added via this API, you can set the value of this field to `true`. \n\nYou **cannot** use this field to change approval setting for a meeting  that was originally scheduled with approval_type `0` (automatic approval).",
              "type": "text"
            },
            {
              "key": "registrants",
              "value": "[{\"first_name\":\"dolore est dolore ex\",\"email\":\"QlxiFO3fdQ@rzgNRxcC.ijep\",\"last_name\":\"enim consequat veniam commodo\"},{\"first_name\":\"in ut proident adipisicing\",\"email\":\"Fk39rzyimgL2P@MAuNNuZMsxZfijeyYnVHAVxkQ.ipd\",\"last_name\":\"incididunt esse mollit ullamco est\"}]",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/meetings/:meetingId/batch_registrants",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "meetings",
            ":meetingId",
            "batch_registrants"
          ],
          "variable": [
            {
              "key": "meetingId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) Unique identifier of the meeting (Meeting Number)."
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}