Chilkat Online Tools

PowerBuilder / Zoom API / Get a user

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Key
string ls_Name
string ls_Value
string ls_StrVal
string ls_Created_at
string ls_Id
string ls_First_name
string ls_Last_name
string ls_Email
integer li_V_type
string ls_Role_name
integer li_Pmi
integer li_Use_pmi
string ls_Personal_meeting_url
string ls_Timezone
integer li_Verified
string ls_Dept
string ls_Last_login_time
string ls_Last_client_version
string ls_Pic_url
string ls_Host_key
string ls_Jid
string ls_Account_id
string ls_Language
string ls_Phone_country
string ls_Phone_number
string ls_Status
string ls_Role_id
string ls_Employee_unique_id
integer li_Account_number
string ls_Manager
integer i
integer li_Count_i

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")

loo_QueryParams.UpdateInt("login_type",100)
loo_QueryParams.UpdateString("encrypted_email","true")
loo_QueryParams.UpdateString("search_by_unique_id","true")

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"

loo_Resp = loo_Http.QuickRequestParams("GET","https://api.zoom.us/v2/users/:userId",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_QueryParams
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

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

// {
//   "created_at": "2018-11-15T01:10:08Z",
//   "custom_attributes": [
//     {
//       "key": "cb3674544gexq",
//       "name": "Country of Citizenship",
//       "value": "Nepal"
//     }
//   ],
//   "id": "z8dsdsdsdsdCfp8uQ",
//   "first_name": "Harry",
//   "last_name": "Grande",
//   "email": "example@example.com",
//   "type": 2,
//   "role_name": "Owner",
//   "pmi": 100000000,
//   "use_pmi": false,
//   "personal_meeting_url": "https://zoom.us/j/6352635623323434343443",
//   "timezone": "America/Los_Angeles",
//   "verified": 1,
//   "dept": "",
//   "last_login_time": "2019-09-13T21:08:52Z",
//   "last_client_version": "4.4.55383.0716(android)",
//   "pic_url": "https://lh4.googleusercontent.com/-hsgfhdgsfghdsfghfd-photo.jpg",
//   "host_key": "0000",
//   "jid": "hghghfghdfghdfhgh@xmpp.zoom.us",
//   "group_ids": [
//   ],
//   "im_group_ids": [
//     "CcSAAAAAAABBBVoQ"
//   ],
//   "account_id": "EAAAAAbbbbbCCCCHMA",
//   "language": "en-US",
//   "phone_country": "USA",
//   "phone_number": "15550100",
//   "status": "active",
//   "role_id": "hdsfwyteg3675hgfs",
//   "employee_unique_id": "dddaaaa",
//   "account_number": 20212021,
//   "manager": "name@example.com"
// }

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

ls_Created_at = loo_JResp.StringOf("created_at")
ls_Id = loo_JResp.StringOf("id")
ls_First_name = loo_JResp.StringOf("first_name")
ls_Last_name = loo_JResp.StringOf("last_name")
ls_Email = loo_JResp.StringOf("email")
li_V_type = loo_JResp.IntOf("type")
ls_Role_name = loo_JResp.StringOf("role_name")
li_Pmi = loo_JResp.IntOf("pmi")
li_Use_pmi = loo_JResp.BoolOf("use_pmi")
ls_Personal_meeting_url = loo_JResp.StringOf("personal_meeting_url")
ls_Timezone = loo_JResp.StringOf("timezone")
li_Verified = loo_JResp.IntOf("verified")
ls_Dept = loo_JResp.StringOf("dept")
ls_Last_login_time = loo_JResp.StringOf("last_login_time")
ls_Last_client_version = loo_JResp.StringOf("last_client_version")
ls_Pic_url = loo_JResp.StringOf("pic_url")
ls_Host_key = loo_JResp.StringOf("host_key")
ls_Jid = loo_JResp.StringOf("jid")
ls_Account_id = loo_JResp.StringOf("account_id")
ls_Language = loo_JResp.StringOf("language")
ls_Phone_country = loo_JResp.StringOf("phone_country")
ls_Phone_number = loo_JResp.StringOf("phone_number")
ls_Status = loo_JResp.StringOf("status")
ls_Role_id = loo_JResp.StringOf("role_id")
ls_Employee_unique_id = loo_JResp.StringOf("employee_unique_id")
li_Account_number = loo_JResp.IntOf("account_number")
ls_Manager = loo_JResp.StringOf("manager")
i = 0
li_Count_i = loo_JResp.SizeOfArray("custom_attributes")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Key = loo_JResp.StringOf("custom_attributes[i].key")
    ls_Name = loo_JResp.StringOf("custom_attributes[i].name")
    ls_Value = loo_JResp.StringOf("custom_attributes[i].value")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("group_ids")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("im_group_ids")
do while i < li_Count_i
    loo_JResp.I = i
    ls_StrVal = loo_JResp.StringOf("im_group_ids[i]")
    i = i + 1
loop


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -G -d "login_type=100"
	-d "encrypted_email=true"
	-d "search_by_unique_id=true"
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/users/:userId

Postman Collection Item JSON

{
  "name": "Get a user",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/users/:userId?login_type=100&encrypted_email=true&search_by_unique_id=true",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "users",
        ":userId"
      ],
      "query": [
        {
          "key": "login_type",
          "value": "100",
          "description": "The user's login method:\n\n`0` — Facebook OAuth</br>`1` — Google OAuth</br>`24` — Apple OAuth</br>`27` — Microsoft OAuth</br>`97` — Mobile device</br>`98` — RingCentral OAuth</br>`99` — API user</br>`100` — Zoom Work email</br>`101` — Single Sign-On (SSO)\n\nThe following login methods are only available in China:\n\n`11` — Phone number</br>`21` — WeChat</br>`23` — Alipay"
        },
        {
          "key": "encrypted_email",
          "value": "true",
          "description": "Whether the email address passed for the `userId` value is an encrypted email address:\n\n* `true` — The email address is encrypted.\n* `false` — The email address is not encrypted.\n\nIf you do not query this parameter, this value defaults to null (`false`)."
        },
        {
          "key": "search_by_unique_id",
          "value": "true",
          "description": "Whether the queried `userId` value is an employee unique ID: \n* `true` — The queried ID is an employee's unique ID. \n* `false` — The queried ID is not an employee's unique ID. \n\nThis value defaults to `false` (null)."
        }
      ],
      "variable": [
        {
          "key": "userId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
        }
      ]
    },
    "description": "Use this API to view a user's information on a Zoom account. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter. \n\n**Note:** Users who have not activated their account will have a `pending` status. These users' `created_at` timestamp will also display the time at which the API call was made, **not** the account's creation date. \n\n**Scopes:** `user:read:admin`, `user:read`, `user_info:read` <br> \n* **Note:** The `user_info:read` scope is only available when you pass the `me` value for the `$userId` value. \n\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200` **OK**<br>\nUser object returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?login_type=100&encrypted_email=true&search_by_unique_id=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "login_type",
              "value": "100"
            },
            {
              "key": "encrypted_email",
              "value": "true"
            },
            {
              "key": "search_by_unique_id",
              "value": "true"
            }
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"created_at\": \"2018-11-15T01:10:08Z\",\n \"custom_attributes\": [\n  {\n   \"key\": \"cb3674544gexq\",\n   \"name\": \"Country of Citizenship\",\n   \"value\": \"Nepal\"\n  }\n ],\n \"id\": \"z8dsdsdsdsdCfp8uQ\",\n \"first_name\": \"Harry\",\n \"last_name\": \"Grande\",\n \"email\": \"example@example.com\",\n \"type\": 2,\n \"role_name\": \"Owner\",\n \"pmi\": 100000000,\n \"use_pmi\": false,\n \"personal_meeting_url\": \"https://zoom.us/j/6352635623323434343443\",\n \"timezone\": \"America/Los_Angeles\",\n \"verified\": 1,\n \"dept\": \"\",\n \"last_login_time\": \"2019-09-13T21:08:52Z\",\n \"last_client_version\": \"4.4.55383.0716(android)\",\n \"pic_url\": \"https://lh4.googleusercontent.com/-hsgfhdgsfghdsfghfd-photo.jpg\",\n \"host_key\": \"0000\",\n \"jid\": \"hghghfghdfghdfhgh@xmpp.zoom.us\",\n \"group_ids\": [],\n \"im_group_ids\": [\n  \"CcSAAAAAAABBBVoQ\"\n ],\n \"account_id\": \"EAAAAAbbbbbCCCCHMA\",\n \"language\": \"en-US\",\n \"phone_country\": \"USA\",\n \"phone_number\": \"15550100\",\n \"status\": \"active\",\n \"role_id\": \"hdsfwyteg3675hgfs\",\n \"employee_unique_id\": \"dddaaaa\",\n \"account_number\": 20212021,\n \"manager\": \"name@example.com\"\n}"
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad Request**<br>\nBad request<br>\n**Error Code:** `1120`<br>\nA valid invitation to join the Zoom account was not found for this user. <br>\nThis error is thrown if you added a user in your account but the user did not accept t",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?login_type=100&encrypted_email=true&search_by_unique_id=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "login_type",
              "value": "100"
            },
            {
              "key": "encrypted_email",
              "value": "true"
            },
            {
              "key": "search_by_unique_id",
              "value": "true"
            }
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "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:** `1001`<br>\nUser does not exist: $userId.<br>",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/users/:userId?login_type=100&encrypted_email=true&search_by_unique_id=true",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId"
          ],
          "query": [
            {
              "key": "login_type",
              "value": "100"
            },
            {
              "key": "encrypted_email",
              "value": "true"
            },
            {
              "key": "search_by_unique_id",
              "value": "true"
            }
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}