Synthetic test APIs

Use these APIs to configure Synthetic tests.

Creating a synthetic test

API version 1.0.0

Command output format application/json

Synthetic APIs support the following test types:

To test an HTTP URL, the sample curl command resembles the following code:

curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN'  -i 'http://<synthetic_route_address>/synthetic/1.0/synthetic_tests' --data '    {
  "label": "TestHTTPRest",
  "syntheticType": "HTTPAction",
  "active": true,
  "description": "this is to a URL with ping",
  "configuration": {
    "url": "http://www.google.com",
    "operation": "GET"
  },
  "schedInterval": 5,
  "playbackMode": "Simultaneous",
  "locations": [
    {
      "_id": "KSN_Location_uipop_three_2ac0-1013"
    }
  ],
  "threshold": {
    "criticalThreshold": 2,
    "warningThreshold": 1
  }
  ]
}
'

The configuration section varies based on the syntheticType.

The response resembles the following code:

HTTP/1.1 201 Created
location: https://<synthetic_route_address>/synthetic/1.0/synthetic_tests/A_vossE9T9q_uMP3NDeuBQ

Updating/Starting/Stoping a synthetic test

API version 1.0.0

API URI components

Command output format application/json

The sample curl command resembles the following code:

curl -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -H 'X-TransactionID: test-txid' -i 'https://<synthetic_route_address>/synthetic/1.0/synthetic_tests/A_vossE9T9q_uMP3NDeuBQ' --data '    {
        "syntheticType": "WebpageScript", 
        "active": false, 
        "description": "Stop this test by setting active: false"     
    }'

Note: To start a test, pdate the active property to true. To stop a test, pdate the active property to false.

The response resembles the following code:

HTTP/1.1 204 No Content

Getting a synthetic test

API version 1.0.0

API URI components

Command output format application/json

The sample curl command resembles the following code:

curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -i 'https://<synthetic_route_address>/synthetic/1.0/synthetic_tests/Te-mVC29TdK1guASXotQGw'

The response resembles the following code:

HTTP/1.1 200 OK
{
  "_id": "Te-mVC29TdK1guASXotQGw",
  "label": "DBlue_Side_V1",
  "description": "this is to test selenium script by Selenium server",
  "syntheticType": "WebpageScript",
  "active": true,
  "schedInterval": 5,
  "playbackMode": "Simultaneous",
  "locations": [{
    "_id": "KSN_Location_uipop_three_2ac0-1013"
  }],
  "configuration": {
    "fileName": "DBlue.side",
    "scriptContents": "ewogICJpZCI6ICJhMDllZDM5Mi1lZjQ2LTRjYmUtYmRiYS1kYTQ4ZDg5OTAyMTEiLAogICJuYW1lIjogIkltcG9ydGVkIHByb2plY3QiLAogICJ1cmwiOiAiIiwKICAidGVzdHMiOiBbewogICAgImlkIjogIlN1cHBvcnQudGVzdGNhc2UuaHRtbCIsCiAgICAibmFtZSI6ICJTdXBwb3J0IiwKICAgICJjb21tYW5kcyI6IFt7CiAgICAgICJpZCI6ICIyNDE3OGUyOS1iNGRmLTQwMjgtOTcyNC1kYjIyMTU1YjI3ZWYiLAogICAgICAiY29tbWVudCI6ICIiLAogICAgICAiY29tbWFuZCI6ICJvcGVuIiwKICAgICAgInRhcmdldCI6ICIvc3VwcG9ydC91cy9zZWFyY2gvaW5kZXguaHRtbCIsCiAgICAgICJ0YXJnZXRzIjogW10sCiAgICAgICJ2YWx1ZSI6ICIiCiAgICB9XQogIH0sIHsKICAgICJpZCI6ICJTZWFyY2gudGVzdGNhc2UuaHRtbCIsCiAgICAibmFtZSI6ICJTZWFyY2giLAogICAgImNvbW1hbmRzIjogWwoJewogICAgICAiaWQiOiAiYjQ2ZTZiODUtZTUzYy00NGRmLTljY2MtN2NiNTJiMDQzNjlkIiwKICAgICAgImNvbW1lbnQiOiAiIiwKICAgICAgImNvbW1hbmQiOiAic3RvcmUiLAogICAgICAidGFyZ2V0IjogInRlc3RlckBjbi5pYm0uY29tIiwKICAgICAgInZhbHVlIjogInVzZXJuYW1lIgogICAgfSwKCXsKICAgICAgImlkIjogIjcxNjY0NGI4LWFmZDgtNDk0NS1hMGU0LTU3M2VkZGFjZjAwMiIsCiAgICAgICJjb21tZW50IjogIiIsCiAgICAgICJjb21tYW5kIjogImNsaWNrIiwKICAgICAgInRhcmdldCI6ICIvLypbQGlkP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0OTdmMjg1NjVjIiwKICAgICJuYW1lIjogIkltcG9ydGVkIHN1aXRlIiwKICAgICJwZXJzaXN0U2Vzc2lvbiI6IHRydWUsCiAgICAicGFyYWxsZWwiOiBmYWxzZSwKICAgICJ0aW1lb3V0IjogMzAwLAogICAgInRlc3RzIjogWyJTdXBwb3J0LnRlc3RjYXNlLmh0bWwiLCAiU2VhcmNoLnRlc3RjYXNlLmh0bWwiLCAiSXRlbS50ZXN0Y2FzZS5odG1sIl0KICB9XSwKICAidXJscyI6IFsiaHR0cDovL3d3dy0wMS5pYm0uY29tLyIsICJodHRwOi8vd3d3LmlibS5jb20vIl0sCiAgInBsdWdpbnMiOiBbXQp9",
    "blacklist": ["datacloud.tealiumiq.com", ".cloudfront.net", "tags.tiqcdn.com\/utag\/ibm\/main\/prod\/utag", ".profile..cloudfront.net\/.png"],
    "whitelist": ["ibm.com", ".s81c.com\/*"]
  },
  "_modifiedAt": "2020-09-22T01:58:43.011Z",
  "_createdBy": "icpuser1-1",
  "status": "normal"
}

Listing the synthetic tests

API version 1.0.0

API URI components

Command output format application/json

The sample curl command resembles the following code:

curl -X GET -H 'Content-Type: application/json' -H 'X-TransactionID: test-txid' -H 'Authorization: Bearer $ACCESS_TOKEN' -i 'https://<synthetic_route_address>/synthetic/1.0/synthetic_tests'

This API also supports query parameters by using sorting (_sort), filtering (_filter), and pagination (_offset and _limit). See the following examples:

_filter=_createdAt>2020-09-17T07:21:11.074Z
_filter=_modifiedAt>2020-09-17T07:21:11.074Z
_offset=0&_limit=200
_sort=+_modifiedAt

The response resembles the following code:

HTTP/1.1 200 OK
{
  "_href": "\/synthetic\/1.0\/synthetic_tests?_offset=0&_limit=100",
  "_offset": "0",
  "_limit": "100",
  "_prev": {
    "_href": "\/synthetic\/1.0\/synthetic_tests?_offset=0&_limit=100"
  },
  "_next": {
    "_href": "\/synthetic\/1.0\/synthetic_tests?_offset=100&_limit=100"
  },
  "items": [
    {
      "_id": "Te-mVC29TdK1guASXotQGw",
      "label": "DBlue_Side_V1",
      "description": "this is to test selenium script by Selenium server",
      "syntheticType": "WebpageScript",
      "active": true,
      "schedInterval": 5,
      "playbackMode": "Simultaneous",
      "locations": [
        {
          "_id": "KSN_Location_uipop_three_2ac0-1013"
        }
      ],
      "configuration": {
        "fileName": "DBlue.side",
        "scriptContents": *********
      },
      "_modifiedAt": "2020-09-17T07:21:11.074Z",
      "_createdBy": "mcmdemo",
      "status": "normal"
    },
    {
      "_id": "axNrd6UKSh-OYq9WTomo3g",
      "label": "TestHTTPR",
      "description": "this is to rest URL",
      "syntheticType": "HTTPAction",
      "active": true,
      "schedInterval": 1,
      "playbackMode": "Simultaneous",
      "locations": [
        {
          "_id": "KSN_Location_uipop_three_2ac0-1013"
        }
      ],
      "configuration": {
        "url": "http:\/\/www.google.com"
      }
      "_modifiedAt": "2020-09-17T06:57:10.300Z",
      "_createdBy": "mcmdemo",
      "status": "normal"
    }
  ]
}

Deleting a synthetic test

API version 1.0.0

API URI components

Command output format application/json

The sample curl command resembles the following code:

curl -X DELETE -H 'Content-Type: application/json' -H 'Authorization: Bearer $ACCESS_TOKEN' -i 'https://<synthetic_route_address>/synthetic/1.0/synthetic_tests/XFqopWQVTCSbVln09CpEnQ'

The response resembles the following code:

HTTP/1.1 204 No Content