Chilkat Online Tools

DataFlex / Support API / Incremental Attributes Values Export

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sAttribute_id
    String sId
    String sName
    String sTime
    String sV_type
    String sAttribute_value_id
    String sInstance_id
    String sCount
    String sEnd_time
    String sNext_page
    Integer i
    Integer iCount_i
    String sTemp1

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

    Set ComBasicAuth Of hoHttp To True
    Set ComLogin Of hoHttp To "login"
    Set ComPassword Of hoHttp To "password"

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://example.zendesk.com/api/v2/incremental/routing/attribute_values" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    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 ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    // {
    //   "attribute_values": [
    //     {
    //       "attribute_id": "<string>",
    //       "id": "<string>",
    //       "name": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     },
    //     {
    //       "attribute_id": "<string>",
    //       "id": "<string>",
    //       "name": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     }
    //   ],
    //   "attributes": [
    //     {
    //       "id": "<string>",
    //       "name": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     },
    //     {
    //       "id": "<string>",
    //       "name": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     }
    //   ],
    //   "count": "<integer>",
    //   "end_time": "<integer>",
    //   "instance_values": [
    //     {
    //       "attribute_value_id": "<string>",
    //       "id": "<string>",
    //       "instance_id": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     },
    //     {
    //       "attribute_value_id": "<string>",
    //       "id": "<string>",
    //       "instance_id": "<string>",
    //       "time": "<dateTime>",
    //       "type": "<string>"
    //     }
    //   ],
    //   "next_page": "<string>"
    // }

    // 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 "count" To sCount
    Get ComStringOf Of hoJResp "end_time" To sEnd_time
    Get ComStringOf Of hoJResp "next_page" To sNext_page
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "attribute_values" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "attribute_values[i].attribute_id" To sAttribute_id
        Get ComStringOf Of hoJResp "attribute_values[i].id" To sId
        Get ComStringOf Of hoJResp "attribute_values[i].name" To sName
        Get ComStringOf Of hoJResp "attribute_values[i].time" To sTime
        Get ComStringOf Of hoJResp "attribute_values[i].type" To sV_type
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "attributes" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "attributes[i].id" To sId
        Get ComStringOf Of hoJResp "attributes[i].name" To sName
        Get ComStringOf Of hoJResp "attributes[i].time" To sTime
        Get ComStringOf Of hoJResp "attributes[i].type" To sV_type
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "instance_values" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "instance_values[i].attribute_value_id" To sAttribute_value_id
        Get ComStringOf Of hoJResp "instance_values[i].id" To sId
        Get ComStringOf Of hoJResp "instance_values[i].instance_id" To sInstance_id
        Get ComStringOf Of hoJResp "instance_values[i].time" To sTime
        Get ComStringOf Of hoJResp "instance_values[i].type" To sV_type
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl  -u login:password -X GET
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/incremental/routing/attribute_values

Postman Collection Item JSON

{
  "name": "Incremental Attributes Values Export",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/incremental/routing/attribute_values",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "incremental",
        "routing",
        "attribute_values"
      ]
    },
    "description": "Returns a stream of changes that occurred on routing attribute values.\n\n#### Allowed For\n\n* Admins\n\n#### Parameters\n\nOptional\n\n| Name   | Type   | Comment\n| ------ | ------ | -------\n| cursor | string | The `cursor` parameter is a non-human-readable argument you can use to move forward or backward in time. The cursor is a read-only URL parameter that's only available in API responses. See [Pagination](#pagination).\n"
  },
  "response": [
    {
      "name": "Success response",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v2/incremental/routing/attribute_values",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "incremental",
            "routing",
            "attribute_values"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"attribute_values\": [\n    {\n      \"attribute_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"name\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    },\n    {\n      \"attribute_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"name\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    }\n  ],\n  \"attributes\": [\n    {\n      \"id\": \"<string>\",\n      \"name\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    },\n    {\n      \"id\": \"<string>\",\n      \"name\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    }\n  ],\n  \"count\": \"<integer>\",\n  \"end_time\": \"<integer>\",\n  \"instance_values\": [\n    {\n      \"attribute_value_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"instance_id\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    },\n    {\n      \"attribute_value_id\": \"<string>\",\n      \"id\": \"<string>\",\n      \"instance_id\": \"<string>\",\n      \"time\": \"<dateTime>\",\n      \"type\": \"<string>\"\n    }\n  ],\n  \"next_page\": \"<string>\"\n}"
    }
  ]
}