Chilkat Online Tools

C / Zoom API / Get webinar participants

Back to Collection Items

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

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject queryParams;
    HCkHttpResponse resp;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;
    const char *id;
    const char *user_id;
    const char *user_name;
    const char *device;
    const char *ip_address;
    const char *location;
    const char *network_type;
    const char *microphone;
    const char *camera;
    const char *speaker;
    const char *data_center;
    const char *full_data_center;
    const char *connection_type;
    const char *join_time;
    const char *leave_time;
    BOOL share_application;
    BOOL share_desktop;
    BOOL share_whiteboard;
    BOOL recording;
    const char *status;
    const char *pc_name;
    const char *domain;
    const char *mac_addr;
    const char *harddisk_id;
    const char *version;
    const char *leave_reason;
    const char *sip_uri;
    const char *from_sip_uri;
    const char *role;
    int page_count;
    int page_size;
    int total_records;
    const char *next_page_token;
    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();

    queryParams = CkJsonObject_Create();
    CkJsonObject_UpdateString(queryParams,"type","live");
    CkJsonObject_UpdateInt(queryParams,"page_size",30);
    CkJsonObject_UpdateString(queryParams,"next_page_token","quis officia in reprehenderit");
    CkJsonObject_UpdateString(queryParams,"include_fields","registrant_id");

    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttp_putAuthToken(http,"<access_token>");

    resp = CkHttp_QuickRequestParams(http,"GET","https://api.zoom.us/v2/metrics/webinars/:webinarId/participants",queryParams);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(queryParams);
        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);
        CkJsonObject_Dispose(queryParams);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    CkHttpResponse_Dispose(resp);

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

    // {
    //   "page_count": 1,
    //   "page_size": 30,
    //   "total_records": 1,
    //   "next_page_token": "",
    //   "participants": [
    //     {
    //       "id": "d52f19c548b88490b5d16fcbd38",
    //       "user_id": "32dsfsd4g5gd",
    //       "user_name": "dojo",
    //       "device": "WIN",
    //       "ip_address": "127.0.0.1",
    //       "location": "New York",
    //       "network_type": "Wired",
    //       "microphone": "Plantronics BT600",
    //       "camera": "FaceTime HD Camera",
    //       "speaker": "Plantronics BT600",
    //       "data_center": "SC",
    //       "full_data_center": "United States;United States (US03_SC CRC)",
    //       "connection_type": "P2P",
    //       "join_time": "2019-09-07T13:15:02.837Z",
    //       "leave_time": "2019-09-07T13:15:09.837Z",
    //       "share_application": false,
    //       "share_desktop": true,
    //       "share_whiteboard": true,
    //       "recording": false,
    //       "status": "in_waiting_room",
    //       "pc_name": "dojo's pc",
    //       "domain": "Dojo-workspace",
    //       "mac_addr": " 00:0a:95:9d:68:16",
    //       "harddisk_id": "sed proident in",
    //       "version": "4.4.55383.0716",
    //       "leave_reason": "Dojo left the meeting.<br>Reason: Host ended the meeting.",
    //       "sip_uri": "sip:sipp@10.100.112.140:11029",
    //       "from_sip_uri": "sip:sipp@10.100.112.140:11029",
    //       "role": "panelist"
    //     }
    //   ]
    // }

    // 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.

    page_count = CkJsonObject_IntOf(jResp,"page_count");
    page_size = CkJsonObject_IntOf(jResp,"page_size");
    total_records = CkJsonObject_IntOf(jResp,"total_records");
    next_page_token = CkJsonObject_stringOf(jResp,"next_page_token");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"participants");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        id = CkJsonObject_stringOf(jResp,"participants[i].id");
        user_id = CkJsonObject_stringOf(jResp,"participants[i].user_id");
        user_name = CkJsonObject_stringOf(jResp,"participants[i].user_name");
        device = CkJsonObject_stringOf(jResp,"participants[i].device");
        ip_address = CkJsonObject_stringOf(jResp,"participants[i].ip_address");
        location = CkJsonObject_stringOf(jResp,"participants[i].location");
        network_type = CkJsonObject_stringOf(jResp,"participants[i].network_type");
        microphone = CkJsonObject_stringOf(jResp,"participants[i].microphone");
        camera = CkJsonObject_stringOf(jResp,"participants[i].camera");
        speaker = CkJsonObject_stringOf(jResp,"participants[i].speaker");
        data_center = CkJsonObject_stringOf(jResp,"participants[i].data_center");
        full_data_center = CkJsonObject_stringOf(jResp,"participants[i].full_data_center");
        connection_type = CkJsonObject_stringOf(jResp,"participants[i].connection_type");
        join_time = CkJsonObject_stringOf(jResp,"participants[i].join_time");
        leave_time = CkJsonObject_stringOf(jResp,"participants[i].leave_time");
        share_application = CkJsonObject_BoolOf(jResp,"participants[i].share_application");
        share_desktop = CkJsonObject_BoolOf(jResp,"participants[i].share_desktop");
        share_whiteboard = CkJsonObject_BoolOf(jResp,"participants[i].share_whiteboard");
        recording = CkJsonObject_BoolOf(jResp,"participants[i].recording");
        status = CkJsonObject_stringOf(jResp,"participants[i].status");
        pc_name = CkJsonObject_stringOf(jResp,"participants[i].pc_name");
        domain = CkJsonObject_stringOf(jResp,"participants[i].domain");
        mac_addr = CkJsonObject_stringOf(jResp,"participants[i].mac_addr");
        harddisk_id = CkJsonObject_stringOf(jResp,"participants[i].harddisk_id");
        version = CkJsonObject_stringOf(jResp,"participants[i].version");
        leave_reason = CkJsonObject_stringOf(jResp,"participants[i].leave_reason");
        sip_uri = CkJsonObject_stringOf(jResp,"participants[i].sip_uri");
        from_sip_uri = CkJsonObject_stringOf(jResp,"participants[i].from_sip_uri");
        role = CkJsonObject_stringOf(jResp,"participants[i].role");
        i = i + 1;
    }



    CkHttp_Dispose(http);
    CkJsonObject_Dispose(queryParams);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

Curl Command

curl -G -d "type=live"
	-d "page_size=30"
	-d "next_page_token=quis%20officia%20in%20reprehenderit"
	-d "include_fields=registrant_id"
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/metrics/webinars/:webinarId/participants

Postman Collection Item JSON

{
  "name": "Get webinar participants",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "metrics",
        "webinars",
        ":webinarId",
        "participants"
      ],
      "query": [
        {
          "key": "type",
          "value": "live",
          "description": "The type of webinar to query: \n* `past` — All past webinars. \n* `live` - All live webinars. \n\nThis value defaults to `live`."
        },
        {
          "key": "page_size",
          "value": "30",
          "description": "The number of records returned within a single API call."
        },
        {
          "key": "next_page_token",
          "value": "quis officia in reprehenderit",
          "description": "The next page token is used to paginate through large result sets. A next page token will be returned whenever the set of available results exceeds the current page size. The expiration period for this token is 15 minutes."
        },
        {
          "key": "include_fields",
          "value": "registrant_id",
          "description": "Additional fields to include in the query: \n* `registrant_id` — Include the webinar registrant's ID. The registrant ID is the [webinar registrant's unique ID](https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarregistrants)."
        }
      ],
      "variable": [
        {
          "key": "webinarId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
        }
      ]
    },
    "description": "Use this API to return information about participants from live or past webinars. \n\n**Note:** \n\nThis API may return empty values for participants' `user_name`, `ip_address`, `location`, and `email` responses when the account calling this API: \n* Does **not** have a signed HIPAA business associate agreement (BAA). \n* Is a [**legacy** HIPAA BAA account](https://marketplace.zoom.us/docs/api-reference/other-references/legacy-business-associate-agreements). \n\n**Scopes:** `dashboard_webinars:read:admin` <br> **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Heavy` \n\n**Prerequisites:** \n* A Business, Education, or API Plan with Webinar add-on."
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nWebinar participants returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "metrics",
            "webinars",
            ":webinarId",
            "participants"
          ],
          "query": [
            {
              "key": "type",
              "value": "live"
            },
            {
              "key": "page_size",
              "value": "30"
            },
            {
              "key": "next_page_token",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "include_fields",
              "value": "registrant_id"
            }
          ],
          "variable": [
            {
              "key": "webinarId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"page_count\": 1,\n \"page_size\": 30,\n \"total_records\": 1,\n \"next_page_token\": \"\",\n \"participants\": [\n  {\n   \"id\": \"d52f19c548b88490b5d16fcbd38\",\n   \"user_id\": \"32dsfsd4g5gd\",\n   \"user_name\": \"dojo\",\n   \"device\": \"WIN\",\n   \"ip_address\": \"127.0.0.1\",\n   \"location\": \"New York\",\n   \"network_type\": \"Wired\",\n   \"microphone\": \"Plantronics BT600\",\n   \"camera\": \"FaceTime HD Camera\",\n   \"speaker\": \"Plantronics BT600\",\n   \"data_center\": \"SC\",\n   \"full_data_center\": \"United States;United States (US03_SC CRC)\",\n   \"connection_type\": \"P2P\",\n   \"join_time\": \"2019-09-07T13:15:02.837Z\",\n   \"leave_time\": \"2019-09-07T13:15:09.837Z\",\n   \"share_application\": false,\n   \"share_desktop\": true,\n   \"share_whiteboard\": true,\n   \"recording\": false,\n   \"status\": \"in_waiting_room\",\n   \"pc_name\": \"dojo's pc\",\n   \"domain\": \"Dojo-workspace\",\n   \"mac_addr\": \" 00:0a:95:9d:68:16\",\n   \"harddisk_id\": \"sed proident in\",\n   \"version\": \"4.4.55383.0716\",\n   \"leave_reason\": \"Dojo left the meeting.<br>Reason: Host ended the meeting.\",\n   \"sip_uri\": \"sip:sipp@10.100.112.140:11029\",\n   \"from_sip_uri\": \"sip:sipp@10.100.112.140:11029\",\n   \"role\": \"panelist\"\n  }\n ]\n}"
    },
    {
      "name": "**Error Code:** `300`<br>\nCan not access webinar info, {webinarId}.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "metrics",
            "webinars",
            ":webinarId",
            "participants"
          ],
          "query": [
            {
              "key": "type",
              "value": "live"
            },
            {
              "key": "page_size",
              "value": "30"
            },
            {
              "key": "next_page_token",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "include_fields",
              "value": "registrant_id"
            }
          ],
          "variable": [
            {
              "key": "webinarId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
            }
          ]
        }
      },
      "status": "Multiple Choices",
      "code": 300,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\n**Error Code:** `3001`<br>\nThis webinar's detail info is not available or ID is not valid.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/metrics/webinars/:webinarId/participants?type=live&page_size=30&next_page_token=quis officia in reprehenderit&include_fields=registrant_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "metrics",
            "webinars",
            ":webinarId",
            "participants"
          ],
          "query": [
            {
              "key": "type",
              "value": "live"
            },
            {
              "key": "page_size",
              "value": "30"
            },
            {
              "key": "next_page_token",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "include_fields",
              "value": "registrant_id"
            }
          ],
          "variable": [
            {
              "key": "webinarId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The webinar's ID or universally unique ID (UUID). \n* If you provide a webinar ID, the API will return a response for the latest webinar instance. \n* If you provide a webinar UUID that begins with a `/` character or contains the `//` characters, you **must** double-encode the webinar UUID before making an API request."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}