DataFlex / Zoom API / Get user's contact details
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 sCountry
String sCode
String sV_number
Boolean iVerified
String sLabel
Integer iIntVal
String sId
String sEmail
String sFirst_name
String sLast_name
String sPresence_status
String sPhone_number
String sExtension_number
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 "query_presence_status" "true" 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/chat/users/me/contacts/:contactId" 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)
// {
// "id": "u487547sic45ing",
// "email": "example@example.com",
// "first_name": "John",
// "last_name": "Doe",
// "presence_status": "Offline",
// "phone_number": "15550100",
// "phone_numbers": [
// {
// "country": "US",
// "code": "+1",
// "number": "15550102",
// "verified": true,
// "label": "Mobile"
// }
// ],
// "direct_numbers": [
// 111111,
// 222222
// ],
// "extension_number": "010"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComStringOf Of hoJResp "id" To sId
Get ComStringOf Of hoJResp "email" To sEmail
Get ComStringOf Of hoJResp "first_name" To sFirst_name
Get ComStringOf Of hoJResp "last_name" To sLast_name
Get ComStringOf Of hoJResp "presence_status" To sPresence_status
Get ComStringOf Of hoJResp "phone_number" To sPhone_number
Get ComStringOf Of hoJResp "extension_number" To sExtension_number
Move 0 To i
Get ComSizeOfArray Of hoJResp "phone_numbers" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "phone_numbers[i].country" To sCountry
Get ComStringOf Of hoJResp "phone_numbers[i].code" To sCode
Get ComStringOf Of hoJResp "phone_numbers[i].number" To sV_number
Get ComBoolOf Of hoJResp "phone_numbers[i].verified" To iVerified
Get ComStringOf Of hoJResp "phone_numbers[i].label" To sLabel
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJResp "direct_numbers" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComIntOf Of hoJResp "direct_numbers[i]" To iIntVal
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -G -d "query_presence_status=true"
-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/chat/users/me/contacts/:contactId
Postman Collection Item JSON
{
"name": "Get user's contact details",
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/chat/users/me/contacts/:contactId?query_presence_status=true",
"host": [
"{{baseUrl}}"
],
"path": [
"chat",
"users",
"me",
"contacts",
":contactId"
],
"query": [
{
"key": "query_presence_status",
"value": "true",
"description": "The presence status of the contact. \nInclude this query parameter with a value of `true` to get the presence status of the contact in the response."
}
],
"variable": [
{
"key": "contactId",
"value": "quis officia in reprehenderit",
"description": "(Required) The user's contact Id or email address. The contact can be either a company contact or an external contact."
}
]
},
"description": "A user under an organization’s Zoom account has internal users listed under Company Contacts in the Zoom Client. A Zoom user can also add another Zoom user as a [contact](https://support.zoom.us/hc/en-us/articles/115004055706-Managing-Contacts). Call this API to get information on a specific contact of the Zoom user.\n\n<p style=\"background-color:#e1f5fe; color:#01579b; padding:8px\"> <b>Note: </b>This API only supports <b>user-managed</b> <a href=\"https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-oauth-app\">OAuth app</a>.</p><br>\n\n**Scope**: `chat_contact:read`<br>\n\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
},
"response": [
{
"name": "**HTTP Status Code:** `200`<br>\nContact information returned.\n\n\n",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/chat/users/me/contacts/:contactId?query_presence_status=true",
"host": [
"{{baseUrl}}"
],
"path": [
"chat",
"users",
"me",
"contacts",
":contactId"
],
"query": [
{
"key": "query_presence_status",
"value": "true"
}
],
"variable": [
{
"key": "contactId",
"value": "quis officia in reprehenderit",
"description": "(Required) The user's contact Id or email address. The contact can be either a company contact or an external contact."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": \"u487547sic45ing\",\n \"email\": \"example@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"presence_status\": \"Offline\",\n \"phone_number\": \"15550100\",\n \"phone_numbers\": [\n {\n \"country\": \"US\",\n \"code\": \"+1\",\n \"number\": \"15550102\",\n \"verified\": true,\n \"label\": \"Mobile\"\n }\n ],\n \"direct_numbers\": [\n 111111,\n 222222\n ],\n \"extension_number\": \"010\"\n}"
},
{
"name": "**HTTP Status Code:** `400`<br>\nBad request<br>\n**Error Code:** `5301`<br>\nRequest to get the presence status of the chat contact failed.",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/chat/users/me/contacts/:contactId?query_presence_status=true",
"host": [
"{{baseUrl}}"
],
"path": [
"chat",
"users",
"me",
"contacts",
":contactId"
],
"query": [
{
"key": "query_presence_status",
"value": "true"
}
],
"variable": [
{
"key": "contactId",
"value": "quis officia in reprehenderit",
"description": "(Required) The user's contact Id or email address. The contact can be either a company contact or an external contact."
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `404`<br>\n**Error Code**: `1001`<br>\nUser does not exist: $contactId",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/chat/users/me/contacts/:contactId?query_presence_status=true",
"host": [
"{{baseUrl}}"
],
"path": [
"chat",
"users",
"me",
"contacts",
":contactId"
],
"query": [
{
"key": "query_presence_status",
"value": "true"
}
],
"variable": [
{
"key": "contactId",
"value": "quis officia in reprehenderit",
"description": "(Required) The user's contact Id or email address. The contact can be either a company contact or an external contact."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}