DataFlex / Support API / Incremental Organization Export
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 sCreated_at
String sDetails
String sExternal_id
String sGroup_id
String sId
String sName
String sNotes
String sEt_37f
String sEa_0
String sEsse_c9
String sShared_comments
String sShared_tickets
String sUpdated_at
String sUrl
String sMagna_6d_
String sNostrud_b
Integer j
Integer iCount_j
String sStrVal
String sCount
String sEnd_of_stream
String sEnd_time
String sNext_page
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
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "login"
Set ComPassword Of hoHttp To "password"
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "start_time" "<integer>" To iSuccess
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://example.zendesk.com/api/v2/incremental/organizations" 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)
// {
// "count": "<integer>",
// "end_of_stream": "<boolean>",
// "end_time": "<integer>",
// "next_page": "<string>",
// "organizations": [
// {
// "created_at": "<string>",
// "details": "<string>",
// "domain_names": [
// "<string>",
// "<string>"
// ],
// "external_id": "<string>",
// "group_id": "<integer>",
// "id": "<integer>",
// "name": "<string>",
// "notes": "<string>",
// "organization_fields": {
// "et_37f": "<string>",
// "ea_0": "<string>",
// "esse_c9": "<string>"
// },
// "shared_comments": "<boolean>",
// "shared_tickets": "<boolean>",
// "tags": [
// "<string>",
// "<string>"
// ],
// "updated_at": "<string>",
// "url": "<string>"
// },
// {
// "created_at": "<string>",
// "details": "<string>",
// "domain_names": [
// "<string>",
// "<string>"
// ],
// "external_id": "<string>",
// "group_id": "<integer>",
// "id": "<integer>",
// "name": "<string>",
// "notes": "<string>",
// "organization_fields": {
// "magna_6d_": "<string>",
// "nostrud_b": "<string>"
// },
// "shared_comments": "<boolean>",
// "shared_tickets": "<boolean>",
// "tags": [
// "<string>",
// "<string>"
// ],
// "updated_at": "<string>",
// "url": "<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_of_stream" To sEnd_of_stream
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 "organizations" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "organizations[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "organizations[i].details" To sDetails
Get ComStringOf Of hoJResp "organizations[i].external_id" To sExternal_id
Get ComStringOf Of hoJResp "organizations[i].group_id" To sGroup_id
Get ComStringOf Of hoJResp "organizations[i].id" To sId
Get ComStringOf Of hoJResp "organizations[i].name" To sName
Get ComStringOf Of hoJResp "organizations[i].notes" To sNotes
Get ComStringOf Of hoJResp "organizations[i].organization_fields.et_37f" To sEt_37f
Get ComStringOf Of hoJResp "organizations[i].organization_fields.ea_0" To sEa_0
Get ComStringOf Of hoJResp "organizations[i].organization_fields.esse_c9" To sEsse_c9
Get ComStringOf Of hoJResp "organizations[i].shared_comments" To sShared_comments
Get ComStringOf Of hoJResp "organizations[i].shared_tickets" To sShared_tickets
Get ComStringOf Of hoJResp "organizations[i].updated_at" To sUpdated_at
Get ComStringOf Of hoJResp "organizations[i].url" To sUrl
Get ComStringOf Of hoJResp "organizations[i].organization_fields.magna_6d_" To sMagna_6d_
Get ComStringOf Of hoJResp "organizations[i].organization_fields.nostrud_b" To sNostrud_b
Move 0 To j
Get ComSizeOfArray Of hoJResp "organizations[i].domain_names" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "organizations[i].domain_names[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "organizations[i].tags" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "organizations[i].tags[j]" To sStrVal
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -u login:password -G -d "start_time=%3Cinteger%3E"
-H "Accept: application/json"
https://example.zendesk.com/api/v2/incremental/organizations
Postman Collection Item JSON
{
"name": "Incremental Organization Export",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/incremental/organizations?start_time=<integer>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"incremental",
"organizations"
],
"query": [
{
"key": "start_time",
"value": "<integer>",
"description": "(Required) The time to start the incremental export from"
}
]
},
"description": "#### Allowed For\n\n * Admins\n\n#### Sideloading\n\nSee [Organizations sideloads](/documentation/ticketing/using-the-zendesk-api/side_loading/#supported-endpoints).\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/organizations?start_time=<integer>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"incremental",
"organizations"
],
"query": [
{
"key": "start_time",
"value": "<integer>",
"description": "(Required) The time to start the incremental export from"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"count\": \"<integer>\",\n \"end_of_stream\": \"<boolean>\",\n \"end_time\": \"<integer>\",\n \"next_page\": \"<string>\",\n \"organizations\": [\n {\n \"created_at\": \"<string>\",\n \"details\": \"<string>\",\n \"domain_names\": [\n \"<string>\",\n \"<string>\"\n ],\n \"external_id\": \"<string>\",\n \"group_id\": \"<integer>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"notes\": \"<string>\",\n \"organization_fields\": {\n \"et_37f\": \"<string>\",\n \"ea_0\": \"<string>\",\n \"esse_c9\": \"<string>\"\n },\n \"shared_comments\": \"<boolean>\",\n \"shared_tickets\": \"<boolean>\",\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ],\n \"updated_at\": \"<string>\",\n \"url\": \"<string>\"\n },\n {\n \"created_at\": \"<string>\",\n \"details\": \"<string>\",\n \"domain_names\": [\n \"<string>\",\n \"<string>\"\n ],\n \"external_id\": \"<string>\",\n \"group_id\": \"<integer>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"notes\": \"<string>\",\n \"organization_fields\": {\n \"magna_6d_\": \"<string>\",\n \"nostrud_b\": \"<string>\"\n },\n \"shared_comments\": \"<boolean>\",\n \"shared_tickets\": \"<boolean>\",\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ],\n \"updated_at\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n}"
}
]
}