DataFlex / Zoom API / List users
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sId
String sFirst_name
String sLast_name
String sEmail
Integer iV_type
Integer iPmi
String sTimezone
Integer iVerified
String sDept
String sCreated_at
String sLast_login_time
String sLast_client_version
String sPic_url
String sStatus
String sEmployee_unique_id
Integer j
Integer iCount_j
String sStrVal
Integer iPage_count
Integer iPage_number
Integer iPage_size
Integer iTotal_records
Integer i
Integer iCount_i
String sTemp1
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(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "status" "active" To iSuccess
Get ComUpdateInt Of hoQueryParams "page_size" 30 To iSuccess
Get ComUpdateString Of hoQueryParams "role_id" "quis officia in reprehenderit" To iSuccess
Get ComUpdateString Of hoQueryParams "page_number" "quis officia in reprehenderit" To iSuccess
Get ComUpdateString Of hoQueryParams "include_fields" "custom_attributes" To iSuccess
Get ComUpdateString Of hoQueryParams "next_page_token" "quis officia in reprehenderit" To iSuccess
// Adds the "Authorization: Bearer <access_token>" header.
Set ComAuthToken Of hoHttp To "<access_token>"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://api.zoom.us/v2/users" vQueryParams 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 Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "page_count": 1,
// "page_number": 1,
// "page_size": 30,
// "total_records": 1,
// "users": [
// {
// "id": "z8yAAAAA8bbbQ",
// "first_name": "Taylor",
// "last_name": "Kim",
// "email": "example@example.com",
// "type": 2,
// "pmi": 111111111,
// "timezone": "America/Los_Angeles",
// "verified": 1,
// "dept": "",
// "created_at": "2018-11-15T01:10:08Z",
// "last_login_time": "2019-09-13T21:08:52Z",
// "last_client_version": "4.4.55383.0716(android)",
// "pic_url": "https://example.com/photo.jpg",
// "im_group_ids": [
// "GroupName"
// ],
// "status": "active",
// "employee_unique_id": "dddaaaa"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComIntOf Of hoJResp "page_count" To iPage_count
Get ComIntOf Of hoJResp "page_number" To iPage_number
Get ComIntOf Of hoJResp "page_size" To iPage_size
Get ComIntOf Of hoJResp "total_records" To iTotal_records
Move 0 To i
Get ComSizeOfArray Of hoJResp "users" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "users[i].id" To sId
Get ComStringOf Of hoJResp "users[i].first_name" To sFirst_name
Get ComStringOf Of hoJResp "users[i].last_name" To sLast_name
Get ComStringOf Of hoJResp "users[i].email" To sEmail
Get ComIntOf Of hoJResp "users[i].type" To iV_type
Get ComIntOf Of hoJResp "users[i].pmi" To iPmi
Get ComStringOf Of hoJResp "users[i].timezone" To sTimezone
Get ComIntOf Of hoJResp "users[i].verified" To iVerified
Get ComStringOf Of hoJResp "users[i].dept" To sDept
Get ComStringOf Of hoJResp "users[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "users[i].last_login_time" To sLast_login_time
Get ComStringOf Of hoJResp "users[i].last_client_version" To sLast_client_version
Get ComStringOf Of hoJResp "users[i].pic_url" To sPic_url
Get ComStringOf Of hoJResp "users[i].status" To sStatus
Get ComStringOf Of hoJResp "users[i].employee_unique_id" To sEmployee_unique_id
Move 0 To j
Get ComSizeOfArray Of hoJResp "users[i].im_group_ids" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "users[i].im_group_ids[j]" To sStrVal
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -G -d "status=active"
-d "page_size=30"
-d "role_id=quis%20officia%20in%20reprehenderit"
-d "page_number=quis%20officia%20in%20reprehenderit"
-d "include_fields=custom_attributes"
-d "next_page_token=quis%20officia%20in%20reprehenderit"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/users
Postman Collection Item JSON
{
"name": "List users",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users?status=active&page_size=30&role_id=quis officia in reprehenderit&page_number=quis officia in reprehenderit&include_fields=custom_attributes&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
],
"query": [
{
"key": "status",
"value": "active",
"description": "The user's status: \n* `active` — An active user. \n* `inactive` — A deactivated user. \n* `pending` — A pending user.\n\nThis value defaults to `active`."
},
{
"key": "page_size",
"value": "30",
"description": "The number of records returned within a single API call."
},
{
"key": "role_id",
"value": "quis officia in reprehenderit",
"description": "The role's unique ID. Use this parameter to filter the response by a specific role. You can use the [List Roles](https://marketplace.zoom.us/docs/api-reference/zoom-api/roles/roles) API to get a role's unique ID value."
},
{
"key": "page_number",
"value": "quis officia in reprehenderit",
"description": "The page number of the current page in the returned records."
},
{
"key": "include_fields",
"value": "custom_attributes",
"description": "Use this parameter to display one of the following attributes in the API call's response: \n* `custom_attributes` — Return the user's custom attributes. \n* `host_key` — Return the user's [host key](https://support.zoom.us/hc/en-us/articles/205172555-Using-your-host-key)."
},
{
"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."
}
]
},
"description": "Use this API to list your account's users. \n\n**Scopes:** `user:read:admin` \n\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nUser list returned.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/users?status=active&page_size=30&role_id=quis officia in reprehenderit&page_number=quis officia in reprehenderit&include_fields=custom_attributes&next_page_token=quis officia in reprehenderit",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
],
"query": [
{
"key": "status",
"value": "active"
},
{
"key": "page_size",
"value": "30"
},
{
"key": "role_id",
"value": "quis officia in reprehenderit"
},
{
"key": "page_number",
"value": "quis officia in reprehenderit"
},
{
"key": "include_fields",
"value": "custom_attributes"
},
{
"key": "next_page_token",
"value": "quis officia in reprehenderit"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"page_count\": 1,\n \"page_number\": 1,\n \"page_size\": 30,\n \"total_records\": 1,\n \"users\": [\n {\n \"id\": \"z8yAAAAA8bbbQ\",\n \"first_name\": \"Taylor\",\n \"last_name\": \"Kim\",\n \"email\": \"example@example.com\",\n \"type\": 2,\n \"pmi\": 111111111,\n \"timezone\": \"America/Los_Angeles\",\n \"verified\": 1,\n \"dept\": \"\",\n \"created_at\": \"2018-11-15T01:10:08Z\",\n \"last_login_time\": \"2019-09-13T21:08:52Z\",\n \"last_client_version\": \"4.4.55383.0716(android)\",\n \"pic_url\": \"https://example.com/photo.jpg\",\n \"im_group_ids\": [\n \"GroupName\"\n ],\n \"status\": \"active\",\n \"employee_unique_id\": \"dddaaaa\"\n }\n ]\n}"
}
]
}