Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
integer li_Count
string ls_Name
string ls_Group
integer li_Last_nodata_ts
integer li_Last_triggered_ts
integer li_Monitor_id
string ls_Monitor_name
string ls_Status
integer j
integer li_Count_j
string ls_StrVal
integer li_Page
integer li_Page_count
integer li_Per_page
integer li_Total_count
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateString("query","tempor Ut sed velit")
loo_QueryParams.UpdateInt("page",0)
loo_QueryParams.UpdateInt("per_page",30)
loo_QueryParams.UpdateString("sort","tempor Ut sed velit")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v1/monitor/groups/search",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "counts": {
// "status": [
// {
// "count": 2,
// "name": "OK"
// }
// ],
// "type": [
// {
// "count": 2,
// "name": "metric"
// }
// ]
// },
// "groups": [
// {
// "group": "*",
// "group_tags": [
// "*"
// ],
// "last_nodata_ts": 0,
// "last_triggered_ts": 1525702966,
// "monitor_id": 2738266,
// "monitor_name": "[demo] Cassandra disk usage is high on {{host.name}}",
// "status": "OK"
// },
// {
// "group": "*",
// "group_tags": [
// "*"
// ],
// "last_nodata_ts": 0,
// "last_triggered_ts": 1525703008,
// "monitor_id": 1576648,
// "monitor_name": "[demo] Disk usage is high on {{host.name}}",
// "status": "OK"
// }
// ],
// "metadata": {
// "page": 0,
// "page_count": 2,
// "per_page": 30,
// "total_count": 2
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
li_Page = loo_JResp.IntOf("metadata.page")
li_Page_count = loo_JResp.IntOf("metadata.page_count")
li_Per_page = loo_JResp.IntOf("metadata.per_page")
li_Total_count = loo_JResp.IntOf("metadata.total_count")
i = 0
li_Count_i = loo_JResp.SizeOfArray("counts.status")
do while i < li_Count_i
loo_JResp.I = i
li_Count = loo_JResp.IntOf("counts.status[i].count")
ls_Name = loo_JResp.StringOf("counts.status[i].name")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("counts.type")
do while i < li_Count_i
loo_JResp.I = i
li_Count = loo_JResp.IntOf("counts.type[i].count")
ls_Name = loo_JResp.StringOf("counts.type[i].name")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("groups")
do while i < li_Count_i
loo_JResp.I = i
ls_Group = loo_JResp.StringOf("groups[i].group")
li_Last_nodata_ts = loo_JResp.IntOf("groups[i].last_nodata_ts")
li_Last_triggered_ts = loo_JResp.IntOf("groups[i].last_triggered_ts")
li_Monitor_id = loo_JResp.IntOf("groups[i].monitor_id")
ls_Monitor_name = loo_JResp.StringOf("groups[i].monitor_name")
ls_Status = loo_JResp.StringOf("groups[i].status")
j = 0
li_Count_j = loo_JResp.SizeOfArray("groups[i].group_tags")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("groups[i].group_tags[j]")
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -G -d "query=tempor%20Ut%20sed%20velit"
-d "page=0"
-d "per_page=30"
-d "sort=tempor%20Ut%20sed%20velit"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/monitor/groups/search
Postman Collection Item JSON
{
"name": "Monitors group search",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/monitor/groups/search?query=tempor Ut sed velit&page=0&per_page=30&sort=tempor Ut sed velit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"monitor",
"groups",
"search"
],
"query": [
{
"key": "query",
"value": "tempor Ut sed velit",
"description": "After entering a search query in your [Manage Monitor page][1] use the query parameter value in the\nURL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2]\npage to learn more.\n\nThe query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.\n\n[1]: https://app.datadoghq.com/monitors/manage\n[2]: /monitors/manage/#find-the-monitors"
},
{
"key": "page",
"value": "0",
"description": "Page to start paginating from."
},
{
"key": "per_page",
"value": "30",
"description": "Number of monitors to return per page."
},
{
"key": "sort",
"value": "tempor Ut sed velit",
"description": "String for sort order, composed of field and sort order separate by a comma, for example `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:\n\n* `name`\n* `status`\n* `tags`"
}
]
},
"description": "Search and filter your monitor groups details."
},
"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/v1/monitor/groups/search?query=tempor Ut sed velit&page=0&per_page=30&sort=tempor Ut sed velit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"monitor",
"groups",
"search"
],
"query": [
{
"key": "query",
"value": "tempor Ut sed velit",
"description": "After entering a search query in your [Manage Monitor page][1] use the query parameter value in the\nURL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2]\npage to learn more.\n\nThe query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.\n\n[1]: https://app.datadoghq.com/monitors/manage\n[2]: /monitors/manage/#find-the-monitors"
},
{
"key": "page",
"value": "0",
"description": "Page to start paginating from."
},
{
"key": "per_page",
"value": "30",
"description": "Number of monitors to return per page."
},
{
"key": "sort",
"value": "tempor Ut sed velit",
"description": "String for sort order, composed of field and sort order separate by a comma, for example `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:\n\n* `name`\n* `status`\n* `tags`"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"counts\": {\n \"status\": [\n {\n \"count\": 2,\n \"name\": \"OK\"\n }\n ],\n \"type\": [\n {\n \"count\": 2,\n \"name\": \"metric\"\n }\n ]\n },\n \"groups\": [\n {\n \"group\": \"*\",\n \"group_tags\": [\n \"*\"\n ],\n \"last_nodata_ts\": 0,\n \"last_triggered_ts\": 1525702966,\n \"monitor_id\": 2738266,\n \"monitor_name\": \"[demo] Cassandra disk usage is high on {{host.name}}\",\n \"status\": \"OK\"\n },\n {\n \"group\": \"*\",\n \"group_tags\": [\n \"*\"\n ],\n \"last_nodata_ts\": 0,\n \"last_triggered_ts\": 1525703008,\n \"monitor_id\": 1576648,\n \"monitor_name\": \"[demo] Disk usage is high on {{host.name}}\",\n \"status\": \"OK\"\n }\n ],\n \"metadata\": {\n \"page\": 0,\n \"page_count\": 2,\n \"per_page\": 30,\n \"total_count\": 2\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/v1/monitor/groups/search?query=tempor Ut sed velit&page=0&per_page=30&sort=tempor Ut sed velit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"monitor",
"groups",
"search"
],
"query": [
{
"key": "query",
"value": "tempor Ut sed velit",
"description": "After entering a search query in your [Manage Monitor page][1] use the query parameter value in the\nURL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2]\npage to learn more.\n\nThe query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.\n\n[1]: https://app.datadoghq.com/monitors/manage\n[2]: /monitors/manage/#find-the-monitors"
},
{
"key": "page",
"value": "0",
"description": "Page to start paginating from."
},
{
"key": "per_page",
"value": "30",
"description": "Number of monitors to return per page."
},
{
"key": "sort",
"value": "tempor Ut sed velit",
"description": "String for sort order, composed of field and sort order separate by a comma, for example `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:\n\n* `name`\n* `status`\n* `tags`"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Forbidden",
"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/v1/monitor/groups/search?query=tempor Ut sed velit&page=0&per_page=30&sort=tempor Ut sed velit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"monitor",
"groups",
"search"
],
"query": [
{
"key": "query",
"value": "tempor Ut sed velit",
"description": "After entering a search query in your [Manage Monitor page][1] use the query parameter value in the\nURL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2]\npage to learn more.\n\nThe query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.\n\n[1]: https://app.datadoghq.com/monitors/manage\n[2]: /monitors/manage/#find-the-monitors"
},
{
"key": "page",
"value": "0",
"description": "Page to start paginating from."
},
{
"key": "per_page",
"value": "30",
"description": "Number of monitors to return per page."
},
{
"key": "sort",
"value": "tempor Ut sed velit",
"description": "String for sort order, composed of field and sort order separate by a comma, for example `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:\n\n* `name`\n* `status`\n* `tags`"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\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/v1/monitor/groups/search?query=tempor Ut sed velit&page=0&per_page=30&sort=tempor Ut sed velit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"monitor",
"groups",
"search"
],
"query": [
{
"key": "query",
"value": "tempor Ut sed velit",
"description": "After entering a search query in your [Manage Monitor page][1] use the query parameter value in the\nURL of the page as value for this parameter. Consult the dedicated [manage monitor documentation][2]\npage to learn more.\n\nThe query can contain any number of space-separated monitor attributes, for instance `query=\"type:metric status:alert\"`.\n\n[1]: https://app.datadoghq.com/monitors/manage\n[2]: /monitors/manage/#find-the-monitors"
},
{
"key": "page",
"value": "0",
"description": "Page to start paginating from."
},
{
"key": "per_page",
"value": "30",
"description": "Number of monitors to return per page."
},
{
"key": "sort",
"value": "tempor Ut sed velit",
"description": "String for sort order, composed of field and sort order separate by a comma, for example `name,asc`. Supported sort directions: `asc`, `desc`. Supported fields:\n\n* `name`\n* `status`\n* `tags`"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
}
]
}