autoit / CleverTap API / Get Events Using Cursor
Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oQueryParams = ObjCreate("Chilkat.JsonObject")
$oQueryParams.UpdateString("cursor","{{cursor}}")
$oHttp.SetRequestHeader "X-CleverTap-Passcode","{{passcode}}"
$oHttp.SetRequestHeader "X-CleverTap-Account-Id","{{id}}"
$oHttp.SetRequestHeader "Content-Type","{{type}}"
Local $oResp = $oHttp.QuickRequestParams("GET","https://api.clevertap.com/1/events.json",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)
Curl Command
curl -G -d "cursor=%7B%7Bcursor%7D%7D"
-H "X-CleverTap-Account-Id: {{id}}"
-H "X-CleverTap-Passcode: {{passcode}}"
-H "Content-Type: {{type}}"
https://api.clevertap.com/1/events.json
Postman Collection Item JSON
{
"name": "Get Events Using Cursor",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var result = JSON.parse(responseBody);",
"pm.globals.set(\"cursor\",result.next_cursor);"
]
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "X-CleverTap-Account-Id",
"value": "{{id}}"
},
{
"key": "X-CleverTap-Passcode",
"value": "{{passcode}}"
},
{
"key": "Content-Type",
"value": "{{type}}"
}
],
"url": {
"raw": "https://api.clevertap.com/1/events.json?cursor={{cursor}}",
"protocol": "https",
"host": [
"api",
"clevertap",
"com"
],
"path": [
"1",
"events.json"
],
"query": [
{
"key": "cursor",
"value": "{{cursor}}"
}
]
}
},
"response": [
]
}