PowerBuilder / Datadog API Collection / Get a browser test's latest results summaries
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
string ls_Check_time
string ls_Probe_dc
string ls_Id
string ls_Name
integer li_Height
integer li_Width
integer li_IsMobile
string ls_Duration
integer li_ErrorCount
integer li_StepCountCompleted
integer li_StepCountTotal
string ls_Result_id
integer li_Status
integer li_Last_timestamp_fetched
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.UpdateInt("from_ts",-62147425)
loo_QueryParams.UpdateInt("to_ts",-62147425)
loo_QueryParams.UpdateString("probe_dc","dolor cillum in")
loo_QueryParams.UpdateString("probe_dc","proident")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v1/synthetics/tests/browser/:public_id/results",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)
// {
// "last_timestamp_fetched": 65993172,
// "results": [
// {
// "check_time": -9878780.847290918,
// "probe_dc": "i",
// "result": {
// "device": {
// "id": "laptop_large",
// "name": "",
// "height": 0,
// "width": 0,
// "isMobile": true
// },
// "duration": 65442267.72030264,
// "errorCount": 64702081,
// "stepCountCompleted": -72535032,
// "stepCountTotal": 82995949
// },
// "result_id": "labore",
// "status": 2
// },
// {
// "check_time": -2600599.1306800246,
// "probe_dc": "ex et tempor",
// "result": {
// "device": {
// "id": "laptop_large",
// "name": "",
// "height": 0,
// "width": 0,
// "isMobile": false
// },
// "duration": 61853655.027596265,
// "errorCount": -10809730,
// "stepCountCompleted": 76168853,
// "stepCountTotal": 95663724
// },
// "result_id": "occaecat",
// "status": 1
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
li_Last_timestamp_fetched = loo_JResp.IntOf("last_timestamp_fetched")
i = 0
li_Count_i = loo_JResp.SizeOfArray("results")
do while i < li_Count_i
loo_JResp.I = i
ls_Check_time = loo_JResp.StringOf("results[i].check_time")
ls_Probe_dc = loo_JResp.StringOf("results[i].probe_dc")
ls_Id = loo_JResp.StringOf("results[i].result.device.id")
ls_Name = loo_JResp.StringOf("results[i].result.device.name")
li_Height = loo_JResp.IntOf("results[i].result.device.height")
li_Width = loo_JResp.IntOf("results[i].result.device.width")
li_IsMobile = loo_JResp.BoolOf("results[i].result.device.isMobile")
ls_Duration = loo_JResp.StringOf("results[i].result.duration")
li_ErrorCount = loo_JResp.IntOf("results[i].result.errorCount")
li_StepCountCompleted = loo_JResp.IntOf("results[i].result.stepCountCompleted")
li_StepCountTotal = loo_JResp.IntOf("results[i].result.stepCountTotal")
ls_Result_id = loo_JResp.StringOf("results[i].result_id")
li_Status = loo_JResp.IntOf("results[i].status")
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -G -d "from_ts=-62147425"
-d "to_ts=-62147425"
-d "probe_dc=dolor%20cillum%20in"
-d "probe_dc=proident"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/synthetics/tests/browser/:public_id/results
Postman Collection Item JSON
{
"name": "Get a browser test's latest results summaries",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/synthetics/tests/browser/:public_id/results?from_ts=-62147425&to_ts=-62147425&probe_dc=dolor cillum in&probe_dc=proident",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"tests",
"browser",
":public_id",
"results"
],
"query": [
{
"key": "from_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds from which to start querying results."
},
{
"key": "to_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds up to which to query results."
},
{
"key": "probe_dc",
"value": "dolor cillum in",
"description": "Locations for which to query results."
},
{
"key": "probe_dc",
"value": "proident",
"description": "Locations for which to query results."
}
],
"variable": [
{
"key": "public_id",
"value": "tempor Ut sed velit"
}
]
},
"description": "Get the last 150 test results summaries for a given Synthetic browser test."
},
"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/synthetics/tests/browser/:public_id/results?from_ts=-62147425&to_ts=-62147425&probe_dc=proident",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"tests",
"browser",
":public_id",
"results"
],
"query": [
{
"key": "from_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds from which to start querying results."
},
{
"key": "to_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds up to which to query results."
},
{
"key": "probe_dc",
"value": "proident",
"description": "Locations for which to query results."
}
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"last_timestamp_fetched\": 65993172,\n \"results\": [\n {\n \"check_time\": -9878780.847290918,\n \"probe_dc\": \"i\",\n \"result\": {\n \"device\": {\n \"id\": \"laptop_large\",\n \"name\": \"\",\n \"height\": 0,\n \"width\": 0,\n \"isMobile\": true\n },\n \"duration\": 65442267.72030264,\n \"errorCount\": 64702081,\n \"stepCountCompleted\": -72535032,\n \"stepCountTotal\": 82995949\n },\n \"result_id\": \"labore\",\n \"status\": 2\n },\n {\n \"check_time\": -2600599.1306800246,\n \"probe_dc\": \"ex et tempor\",\n \"result\": {\n \"device\": {\n \"id\": \"laptop_large\",\n \"name\": \"\",\n \"height\": 0,\n \"width\": 0,\n \"isMobile\": false\n },\n \"duration\": 61853655.027596265,\n \"errorCount\": -10809730,\n \"stepCountCompleted\": 76168853,\n \"stepCountTotal\": 95663724\n },\n \"result_id\": \"occaecat\",\n \"status\": 1\n }\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/synthetics/tests/browser/:public_id/results?from_ts=-62147425&to_ts=-62147425&probe_dc=proident",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"tests",
"browser",
":public_id",
"results"
],
"query": [
{
"key": "from_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds from which to start querying results."
},
{
"key": "to_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds up to which to query results."
},
{
"key": "probe_dc",
"value": "proident",
"description": "Locations for which to query results."
}
],
"variable": [
{
"key": "public_id"
}
]
}
},
"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": "- Synthetic Monitoring is not activated for the user\n- Test is not owned by the user",
"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/synthetics/tests/browser/:public_id/results?from_ts=-62147425&to_ts=-62147425&probe_dc=proident",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"tests",
"browser",
":public_id",
"results"
],
"query": [
{
"key": "from_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds from which to start querying results."
},
{
"key": "to_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds up to which to query results."
},
{
"key": "probe_dc",
"value": "proident",
"description": "Locations for which to query results."
}
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_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/synthetics/tests/browser/:public_id/results?from_ts=-62147425&to_ts=-62147425&probe_dc=proident",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"tests",
"browser",
":public_id",
"results"
],
"query": [
{
"key": "from_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds from which to start querying results."
},
{
"key": "to_ts",
"value": "-62147425",
"description": "Timestamp in milliseconds up to which to query results."
},
{
"key": "probe_dc",
"value": "proident",
"description": "Locations for which to query results."
}
],
"variable": [
{
"key": "public_id"
}
]
}
},
"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}"
}
]
}