Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcDevice
LOCAL lcDuration
LOCAL lcExecution_rule
LOCAL lcLocation
LOCAL lcResult_id
LOCAL lcRetries
LOCAL lcStatus
LOCAL lcTest_name
LOCAL lcTest_public_id
LOCAL lcTest_type
LOCAL lcV_Url
LOCAL lcName
LOCAL lcBranch
LOCAL lcCommitSha
LOCAL lcStatus
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')
loHttp.SetRequestHeader("Accept","application/json")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://api.app.ddog-gov.com/api/v1/synthetics/ci/batch/:batch_id",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* 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 = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "data": {
* "metadata": {
* "ci": {
* "pipeline": {
* "url": "dolor irure amet aliqua"
* },
* "provider": {
* "name": "velit voluptate minim tempor et"
* }
* },
* "git": {
* "branch": "proident pariatur cillum ipsum",
* "commitSha": "no"
* }
* },
* "results": [
* {
* "device": "laptop_large",
* "duration": 77555392.34670219,
* "execution_rule": "blocking",
* "location": "nostrud consectetur proident elit",
* "result_id": "ad in",
* "retries": 27165346.602910966,
* "status": "passed",
* "test_name": "in Excepteur",
* "test_public_id": "aute sint",
* "test_type": "browser"
* },
* {
* "device": "laptop_large",
* "duration": -71572766.6529502,
* "execution_rule": "non_blocking",
* "location": "velit ullamco",
* "result_id": "quis irure officia Lorem enim",
* "retries": 66253781.442619294,
* "status": "passed",
* "test_name": "reprehenderit voluptate incididu",
* "test_public_id": "ipsum Duis",
* "test_type": "api"
* }
* ],
* "status": "passed"
* }
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcV_Url = loJResp.StringOf("data.metadata.ci.pipeline.url")
lcName = loJResp.StringOf("data.metadata.ci.provider.name")
lcBranch = loJResp.StringOf("data.metadata.git.branch")
lcCommitSha = loJResp.StringOf("data.metadata.git.commitSha")
lcStatus = loJResp.StringOf("data.status")
i = 0
lnCount_i = loJResp.SizeOfArray("data.results")
DO WHILE i < lnCount_i
loJResp.I = i
lcDevice = loJResp.StringOf("data.results[i].device")
lcDuration = loJResp.StringOf("data.results[i].duration")
lcExecution_rule = loJResp.StringOf("data.results[i].execution_rule")
lcLocation = loJResp.StringOf("data.results[i].location")
lcResult_id = loJResp.StringOf("data.results[i].result_id")
lcRetries = loJResp.StringOf("data.results[i].retries")
lcStatus = loJResp.StringOf("data.results[i].status")
lcTest_name = loJResp.StringOf("data.results[i].test_name")
lcTest_public_id = loJResp.StringOf("data.results[i].test_public_id")
lcTest_type = loJResp.StringOf("data.results[i].test_type")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/synthetics/ci/batch/:batch_id
Postman Collection Item JSON
{
"name": "Get details of batch",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/synthetics/ci/batch/:batch_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"ci",
"batch",
":batch_id"
],
"variable": [
{
"key": "batch_id",
"value": "tempor Ut sed velit"
}
]
},
"description": "Get a batch's updated 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/synthetics/ci/batch/:batch_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"ci",
"batch",
":batch_id"
],
"variable": [
{
"key": "batch_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": {\n \"metadata\": {\n \"ci\": {\n \"pipeline\": {\n \"url\": \"dolor irure amet aliqua\"\n },\n \"provider\": {\n \"name\": \"velit voluptate minim tempor et\"\n }\n },\n \"git\": {\n \"branch\": \"proident pariatur cillum ipsum\",\n \"commitSha\": \"no\"\n }\n },\n \"results\": [\n {\n \"device\": \"laptop_large\",\n \"duration\": 77555392.34670219,\n \"execution_rule\": \"blocking\",\n \"location\": \"nostrud consectetur proident elit\",\n \"result_id\": \"ad in\",\n \"retries\": 27165346.602910966,\n \"status\": \"passed\",\n \"test_name\": \"in Excepteur\",\n \"test_public_id\": \"aute sint\",\n \"test_type\": \"browser\"\n },\n {\n \"device\": \"laptop_large\",\n \"duration\": -71572766.6529502,\n \"execution_rule\": \"non_blocking\",\n \"location\": \"velit ullamco\",\n \"result_id\": \"quis irure officia Lorem enim\",\n \"retries\": 66253781.442619294,\n \"status\": \"passed\",\n \"test_name\": \"reprehenderit voluptate incididu\",\n \"test_public_id\": \"ipsum Duis\",\n \"test_type\": \"api\"\n }\n ],\n \"status\": \"passed\"\n }\n}"
},
{
"name": "Batch does not exist.",
"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/ci/batch/:batch_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"ci",
"batch",
":batch_id"
],
"variable": [
{
"key": "batch_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/ci/batch/:batch_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"synthetics",
"ci",
"batch",
":batch_id"
],
"variable": [
{
"key": "batch_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}"
}
]
}