Tyk v2.2 Documentation Components

  1. Home
  2. Tyk v2.2 Documentation Components
  3. Uptime tests configuration: API Definition

Uptime tests configuration: API Definition

Uptime test check lists sit within API configurations, so in your API Definition add a section for the tests:

uptime_tests: {
    check_list: [
        {
            "url": "http://google.com/"
        },
        {
            "url": "http://posttestserver.com/post.php?dir=uptime-checker",
            "method": "POST",
            "headers": {
                "this": "that",
                "more": "beans"
            },
            "body": "VEhJUyBJUyBBIEJPRFkgT0JKRUNUIFRFWFQNCg0KTW9yZSBzdHVmZiBoZXJl"
        }
    ]
},

Uptime tests are not versioned.

In the above example there are two forms for the Uptime test, a “quick” form, which assumes a GET request:

{
    "url": "http://google.com/"
}

Or a long form, which allows for a full request to be checked or mocked:

{
    "url": "http://posttestserver.com/post.php?dir=tyk-checker-target-test&beep=boop",
    "method": "POST",
    "headers": {
      "this": "that",
      "more": "beans"
    },
    "body": "VEhJUyBJUyBBIEJPRFkgT0JKRUNUIFRFWFQNCg0KTW9yZSBzdHVmZiBoZXJl"
}

The body is Base64 encoded.

Note: using the quick form will not enforce a timeout, while the long form will fail with a 500ms timeout.