Chilkat Online Tools

DataFlex / Zoom API / Search company contacts

Back to Collection Items

Use ChilkatAx-9.5.0-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 sEmail
    String sFirst_name
    String sLast_name
    String sPresence_status
    String sPhone_number
    String sSip_phone_number
    String sExtension_number
    String sIm_group_id
    String sIm_group_name
    String sDept
    String sJob_title
    String sLocation
    String sSip_uri
    Integer iContact_type
    Integer j
    Integer iCount_j
    String sCountry
    String sCode
    String sV_number
    Boolean iVerified
    String sLabel
    Integer iIntVal
    Integer iPage_size
    String sNext_page_token
    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 "search_key" "quis officia in reprehenderit" To iSuccess
    Get ComUpdateString Of hoQueryParams "query_presence_status" "quis officia in reprehenderit" To iSuccess
    Get ComUpdateInt Of hoQueryParams "page_size" 1 To iSuccess
    Get ComUpdateInt Of hoQueryParams "contact_types" 1 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/contacts" 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_size": 1,
    //   "next_page_token": " ",
    //   "contacts": [
    //     {
    //       "id": "isds324bdfsf",
    //       "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"
    //         }
    //       ],
    //       "sip_phone_number": "11111111",
    //       "direct_numbers": [
    //         111111,
    //         222222
    //       ],
    //       "extension_number": "010",
    //       "im_group_id": "fhksdhfew34hjds",
    //       "im_group_name": "Engineering",
    //       "dept": "Engineering",
    //       "job_title": "Engineer",
    //       "location": "New York",
    //       "sip_uri": "800@aaa.example.com",
    //       "contact_type": 1
    //     }
    //   ]
    // }

    // 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_size" To iPage_size
    Get ComStringOf Of hoJResp "next_page_token" To sNext_page_token
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "contacts" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "contacts[i].id" To sId
        Get ComStringOf Of hoJResp "contacts[i].email" To sEmail
        Get ComStringOf Of hoJResp "contacts[i].first_name" To sFirst_name
        Get ComStringOf Of hoJResp "contacts[i].last_name" To sLast_name
        Get ComStringOf Of hoJResp "contacts[i].presence_status" To sPresence_status
        Get ComStringOf Of hoJResp "contacts[i].phone_number" To sPhone_number
        Get ComStringOf Of hoJResp "contacts[i].sip_phone_number" To sSip_phone_number
        Get ComStringOf Of hoJResp "contacts[i].extension_number" To sExtension_number
        Get ComStringOf Of hoJResp "contacts[i].im_group_id" To sIm_group_id
        Get ComStringOf Of hoJResp "contacts[i].im_group_name" To sIm_group_name
        Get ComStringOf Of hoJResp "contacts[i].dept" To sDept
        Get ComStringOf Of hoJResp "contacts[i].job_title" To sJob_title
        Get ComStringOf Of hoJResp "contacts[i].location" To sLocation
        Get ComStringOf Of hoJResp "contacts[i].sip_uri" To sSip_uri
        Get ComIntOf Of hoJResp "contacts[i].contact_type" To iContact_type
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "contacts[i].phone_numbers" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "contacts[i].phone_numbers[j].country" To sCountry
            Get ComStringOf Of hoJResp "contacts[i].phone_numbers[j].code" To sCode
            Get ComStringOf Of hoJResp "contacts[i].phone_numbers[j].number" To sV_number
            Get ComBoolOf Of hoJResp "contacts[i].phone_numbers[j].verified" To iVerified
            Get ComStringOf Of hoJResp "contacts[i].phone_numbers[j].label" To sLabel
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "contacts[i].direct_numbers" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComIntOf Of hoJResp "contacts[i].direct_numbers[j]" To iIntVal
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -G -d "search_key=quis%20officia%20in%20reprehenderit"
	-d "query_presence_status=quis%20officia%20in%20reprehenderit"
	-d "page_size=1"
	-d "contact_types=1"
	-d "next_page_token=quis%20officia%20in%20reprehenderit"
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/contacts

Postman Collection Item JSON

{
  "name": "Search company contacts",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/contacts?search_key=quis officia in reprehenderit&query_presence_status=quis officia in reprehenderit&page_size=1&contact_types=1&next_page_token=quis officia in reprehenderit",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "contacts"
      ],
      "query": [
        {
          "key": "search_key",
          "value": "quis officia in reprehenderit",
          "description": "(Required) Provide the keyword - either first name, last name or email of the contact whom you have to search for."
        },
        {
          "key": "query_presence_status",
          "value": "quis officia in reprehenderit",
          "description": "Set `query_presence_status` to `true` in order to include the presence status of a contact in the response."
        },
        {
          "key": "page_size",
          "value": "1",
          "description": "The number of records to be returned with a single API call."
        },
        {
          "key": "contact_types",
          "value": "1",
          "description": "A comma-separated list of the type of user contact to query: \n* `1` — A Zoom user. \n* `2` — An auto receptionist. \n* `3` — A common area phone. \n* `4` — A call queue. \n * `5` — A shared line group. \n* `6` — A shared global directory. \n* `7` — A shared office contact. \n\n**Note:** \n* You must have a [phone management role with the \"**View**\" permission](https://support.zoom.us/hc/en-us/articles/360042099012-Using-Zoom-Phone-role-management) to query the `2`, `3`, `4`, `5`, and `7` values. \n* You must provide a valid `search_key` value to query this parameter."
        },
        {
          "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": "A user under an organization's Zoom account has internal users listed under Company Contacts in the Zoom Client. Use this API to search users that are in the company contacts of a Zoom account. Using the `search_key` query parameter, provide either first name, last name or the email address of the user that you would like to search for. Optionally, set `query_presence_status` to `true` in order to include the presence status of a contact. <br><br>\n\n**Scopes:** `contact:read:admin`, `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 returned successfully.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/contacts?search_key=quis officia in reprehenderit&query_presence_status=quis officia in reprehenderit&page_size=1&contact_types=1&next_page_token=quis officia in reprehenderit",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "contacts"
          ],
          "query": [
            {
              "key": "search_key",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "query_presence_status",
              "value": "quis officia in reprehenderit"
            },
            {
              "key": "page_size",
              "value": "1"
            },
            {
              "key": "contact_types",
              "value": "1"
            },
            {
              "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_size\": 1,\n \"next_page_token\": \" \",\n \"contacts\": [\n  {\n   \"id\": \"isds324bdfsf\",\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   \"sip_phone_number\": \"11111111\",\n   \"direct_numbers\": [\n    111111,\n    222222\n   ],\n   \"extension_number\": \"010\",\n   \"im_group_id\": \"fhksdhfew34hjds\",\n   \"im_group_name\": \"Engineering\",\n   \"dept\": \"Engineering\",\n   \"job_title\": \"Engineer\",\n   \"location\": \"New York\",\n   \"sip_uri\": \"800@aaa.example.com\",\n   \"contact_type\": 1\n  }\n ]\n}"
    }
  ]
}