Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loQueryParams
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcCmdline
LOCAL lcHost
LOCAL lcPid
LOCAL lcPpid
LOCAL lcStart
LOCAL lcTimestamp
LOCAL lcUser
LOCAL lcId
LOCAL lcV_type
LOCAL j
LOCAL lnCount_j
LOCAL lcStrVal
LOCAL lcAfter
LOCAL lcSize
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loQueryParams = CreateObject('Chilkat.JsonObject')
loQueryParams.UpdateString("search","<string>")
loQueryParams.UpdateString("tags","<string>")
loQueryParams.UpdateString("from","<long>")
loQueryParams.UpdateString("to","<long>")
loQueryParams.UpdateInt("page[limit]",1000)
loQueryParams.UpdateString("page[cursor]","<string>")
loHttp.SetRequestHeader("Accept","application/json")
loResp = loHttp.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v2/processes",loQueryParams)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loQueryParams
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loResp.Header
? "Failed."
RELEASE loResp
RELEASE loHttp
RELEASE loQueryParams
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
RELEASE loResp
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "data": [
* {
* "attributes": {
* "cmdline": "<string>",
* "host": "<string>",
* "pid": "<long>",
* "ppid": "<long>",
* "start": "<string>",
* "tags": [
* "<string>",
* "<string>"
* ],
* "timestamp": "<string>",
* "user": "<string>"
* },
* "id": "<string>",
* "type": "process"
* },
* {
* "attributes": {
* "cmdline": "<string>",
* "host": "<string>",
* "pid": "<long>",
* "ppid": "<long>",
* "start": "<string>",
* "tags": [
* "<string>",
* "<string>"
* ],
* "timestamp": "<string>",
* "user": "<string>"
* },
* "id": "<string>",
* "type": "process"
* }
* ],
* "meta": {
* "page": {
* "after": "<string>",
* "size": "<integer>"
* }
* }
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcAfter = loJResp.StringOf("meta.page.after")
lcSize = loJResp.StringOf("meta.page.size")
i = 0
lnCount_i = loJResp.SizeOfArray("data")
DO WHILE i < lnCount_i
loJResp.I = i
lcCmdline = loJResp.StringOf("data[i].attributes.cmdline")
lcHost = loJResp.StringOf("data[i].attributes.host")
lcPid = loJResp.StringOf("data[i].attributes.pid")
lcPpid = loJResp.StringOf("data[i].attributes.ppid")
lcStart = loJResp.StringOf("data[i].attributes.start")
lcTimestamp = loJResp.StringOf("data[i].attributes.timestamp")
lcUser = loJResp.StringOf("data[i].attributes.user")
lcId = loJResp.StringOf("data[i].id")
lcV_type = loJResp.StringOf("data[i].type")
j = 0
lnCount_j = loJResp.SizeOfArray("data[i].attributes.tags")
DO WHILE j < lnCount_j
loJResp.J = j
lcStrVal = loJResp.StringOf("data[i].attributes.tags[j]")
j = j + 1
ENDDO
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loQueryParams
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -G -d "search=%3Cstring%3E"
-d "tags=%3Cstring%3E"
-d "from=%3Clong%3E"
-d "to=%3Clong%3E"
-d "page[limit]=1000"
-d "page[cursor]=%3Cstring%3E"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v2/processes
Postman Collection Item JSON
{
"name": "Get all processes",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/processes?search=<string>&tags=<string>&from=<long>&to=<long>&page[limit]=1000&page[cursor]=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"processes"
],
"query": [
{
"key": "search",
"value": "<string>",
"description": "String to search processes by."
},
{
"key": "tags",
"value": "<string>",
"description": "Comma-separated list of tags to filter processes by."
},
{
"key": "from",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the start of the query window.\nIf not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "to",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the end of the query window.\nIf not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "page[limit]",
"value": "1000",
"description": "Maximum number of results returned."
},
{
"key": "page[cursor]",
"value": "<string>",
"description": "String to query the next page of results.\nThis key is provided with each valid response from the API in `meta.page.after`."
}
]
},
"description": "Get all processes for your organization."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/processes?search=<string>&tags=<string>&from=<long>&to=<long>&page[limit]=1000&page[cursor]=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"processes"
],
"query": [
{
"key": "search",
"value": "<string>",
"description": "String to search processes by."
},
{
"key": "tags",
"value": "<string>",
"description": "Comma-separated list of tags to filter processes by."
},
{
"key": "from",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the start of the query window.\nIf not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "to",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the end of the query window.\nIf not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "page[limit]",
"value": "1000",
"description": "Maximum number of results returned."
},
{
"key": "page[cursor]",
"value": "<string>",
"description": "String to query the next page of results.\nThis key is provided with each valid response from the API in `meta.page.after`."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"attributes\": {\n \"cmdline\": \"<string>\",\n \"host\": \"<string>\",\n \"pid\": \"<long>\",\n \"ppid\": \"<long>\",\n \"start\": \"<string>\",\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ],\n \"timestamp\": \"<string>\",\n \"user\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"type\": \"process\"\n },\n {\n \"attributes\": {\n \"cmdline\": \"<string>\",\n \"host\": \"<string>\",\n \"pid\": \"<long>\",\n \"ppid\": \"<long>\",\n \"start\": \"<string>\",\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ],\n \"timestamp\": \"<string>\",\n \"user\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"type\": \"process\"\n }\n ],\n \"meta\": {\n \"page\": {\n \"after\": \"<string>\",\n \"size\": \"<integer>\"\n }\n }\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/processes?search=<string>&tags=<string>&from=<long>&to=<long>&page[limit]=1000&page[cursor]=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"processes"
],
"query": [
{
"key": "search",
"value": "<string>",
"description": "String to search processes by."
},
{
"key": "tags",
"value": "<string>",
"description": "Comma-separated list of tags to filter processes by."
},
{
"key": "from",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the start of the query window.\nIf not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "to",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the end of the query window.\nIf not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "page[limit]",
"value": "1000",
"description": "Maximum number of results returned."
},
{
"key": "page[cursor]",
"value": "<string>",
"description": "String to query the next page of results.\nThis key is provided with each valid response from the API in `meta.page.after`."
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
},
{
"name": "Authentication Error",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/processes?search=<string>&tags=<string>&from=<long>&to=<long>&page[limit]=1000&page[cursor]=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"processes"
],
"query": [
{
"key": "search",
"value": "<string>",
"description": "String to search processes by."
},
{
"key": "tags",
"value": "<string>",
"description": "Comma-separated list of tags to filter processes by."
},
{
"key": "from",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the start of the query window.\nIf not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "to",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the end of the query window.\nIf not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "page[limit]",
"value": "1000",
"description": "Maximum number of results returned."
},
{
"key": "page[cursor]",
"value": "<string>",
"description": "String to query the next page of results.\nThis key is provided with each valid response from the API in `meta.page.after`."
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
},
{
"name": "Too many requests",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/processes?search=<string>&tags=<string>&from=<long>&to=<long>&page[limit]=1000&page[cursor]=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"processes"
],
"query": [
{
"key": "search",
"value": "<string>",
"description": "String to search processes by."
},
{
"key": "tags",
"value": "<string>",
"description": "Comma-separated list of tags to filter processes by."
},
{
"key": "from",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the start of the query window.\nIf not provided, the start of the query window will be 15 minutes before the `to` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "to",
"value": "<long>",
"description": "Unix timestamp (number of seconds since epoch) of the end of the query window.\nIf not provided, the end of the query window will be 15 minutes after the `from` timestamp. If neither\n`from` nor `to` are provided, the query window will be `[now - 15m, now]`."
},
{
"key": "page[limit]",
"value": "1000",
"description": "Maximum number of results returned."
},
{
"key": "page[cursor]",
"value": "<string>",
"description": "String to query the next page of results.\nThis key is provided with each valid response from the API in `meta.page.after`."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
}
]
}