Chilkat Online Tools

Perl / Datadog API Collection / Get a browser test result

Back to Collection Items

use chilkat();

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = chilkat::CkHttp->new();

$http->SetRequestHeader("Accept","application/json");

$sbResponseBody = chilkat::CkStringBuilder->new();
$success = $http->QuickGetSb("https://api.app.ddog-gov.com/api/v1/synthetics/tests/browser/:public_id/results/:result_id",$sbResponseBody);
if ($success == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

$jResp = chilkat::CkJsonObject->new();
$jResp->LoadSb($sbResponseBody);
$jResp->put_EmitCompact(0);

print "Response Body:" . "\r\n";
print $jResp->emit() . "\r\n";

$respStatusCode = $http->get_LastStatus();
print "Response Status Code = " . $respStatusCode . "\r\n";
if ($respStatusCode >= 400) {
    print "Response Header:" . "\r\n";
    print $http->lastHeader() . "\r\n";
    print "Failed." . "\r\n";
    exit;
}

Curl Command

curl -X GET
	-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/synthetics/tests/browser/:public_id/results/:result_id

Postman Collection Item JSON

{
  "name": "Get a browser test result",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v1/synthetics/tests/browser/:public_id/results/:result_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "synthetics",
        "tests",
        "browser",
        ":public_id",
        "results",
        ":result_id"
      ],
      "variable": [
        {
          "key": "public_id",
          "value": "tempor Ut sed velit"
        },
        {
          "key": "result_id",
          "value": "tempor Ut sed velit"
        }
      ]
    },
    "description": "Get a specific full result from 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/:result_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "browser",
            ":public_id",
            "results",
            ":result_id"
          ],
          "variable": [
            {
              "key": "public_id"
            },
            {
              "key": "result_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "null"
    },
    {
      "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/:result_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "browser",
            ":public_id",
            "results",
            ":result_id"
          ],
          "variable": [
            {
              "key": "public_id"
            },
            {
              "key": "result_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 or result 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/:result_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "browser",
            ":public_id",
            "results",
            ":result_id"
          ],
          "variable": [
            {
              "key": "public_id"
            },
            {
              "key": "result_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/:result_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v1",
            "synthetics",
            "tests",
            "browser",
            ":public_id",
            "results",
            ":result_id"
          ],
          "variable": [
            {
              "key": "public_id"
            },
            {
              "key": "result_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}"
    }
  ]
}