REST API Health Test

A REST API (Representational State Transfer Application Programming Interface) is a web service architecture that enables communication client (such as web or mobile apps) and server over HTTP using standard methods such as GET, POST, PUT, and DELETE. REST APIs are widely used in modern web applications because they support scalable, modular, and loosely coupled system design, allowing different services to interact reliably. If the REST APIs are unavailable or are not functioning properly, users may encounter potential bottlenecks such as downtime, slow response, or incorrect data delivery. This in turn may lead to degraded user experience, loss of reliability and revenue, and potential system-wide failures in dependent business-critical services. To avoid such anamolies and provide a consistent user experience, availability and health of the REST APIs should be continuously monitored. The REST API Health test helps administrators in this regard!

This test continuously monitors the configured API URLs, and reports availability and responsiveness of each URL. Using these metrics, administrators can instantly know of high response times, DNS lookup delays, or TCP connection delays, which indicate network bottlenecks or server overload. Additionally, this test also sheds light on the content mismatch failures (if any).

Target of the test : A REST Web Application

Agent deploying the test : An external Agent

Outputs of the test : One set of results for every API URL being monitored

Configurable parameters for the test
Parameter Description

Test Period

How often should the test be executed.

Host

The IP address of the host for which this test is to be configured.

Port

Refers to the port at which the specified host listens to. By default, this is NULL.

Configured APIs

This test helps you to determine the availability and responsiveness of a specific API. To enable this, you need to configure the test with the URL of one or more APIs that it should access. The steps for configuring the URL are explained in Configuring REST APIs for Monitoring.

Capture Response Header

By default, this parameter is disabled, indicating that the test will not capture response headers during API execution. However, if detailed inspection of server responses is required, this parameter can be enabled by moving the slider to the right. Once enabled, the test captures and stores all response headers for analysis, troubleshooting, and validation purposes.

Enable Header Masking

By default, this parameter is disabled. Enabling this parameter ensures that sensitive HTTP header values (such as Authorization tokens, API keys, and cookies) in the API response are masked and not exposed during logging, reporting, or analysis. The headers are still sent with the request, but their values are masked in monitoring outputs to prevent exposure of confidential information.

Detailed Diagnosis

To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

  • The eG manager license should allow the detailed diagnosis capability
  • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test
Measurement Description Measurement Unit Interpretation

Availability of the API

Indicates whether this API URl web site is available or not.

Percent

Availability failures could be caused by several factors such as the web server process(es) being down, the web server being misconfigured, a network failure, etc. Temporary unavailability may also occur if the web server is overloaded. Availability is determined based on the response code returned by the server. A response code between 200 to 300 indicates that the server is available. 

Status of the API

Indicates the current status of this API.

 

The values that this measure reports and their corresponding numeric values have been discussed in the table below:

Measure Value Numeric Value
Error 0
Unknown 25
Failed 50
Canceled 75
Success 100

Note:

By default, this measure reports the above-mentioned Measure Values while indicating the current status of each API. However, in the graph of this measure, status will be represented using the corresponding numeric equivalents only.

Total time for API response

Indicates the time taken by the server to respond to the requests it receives.

Seconds

Response time being high denotes a problem. Poor response times may be due to the server being overloaded or misconfigured. If the URL accessed involves the generation of dynamic content by the server, backend problems (e.g., an overload at the application server or a database failure) can also result in an increase in response time.

Time to first byte of API response

Indicates the time taken to receive the first byte of API response.

Seconds

If the value of this measure is hing, it may indicate the backend processing delay or server latency.

Download time of API response

Indicates the time taken to fully download the response payload.

Seconds

A low value is preferred for this measure. A high value for this measure denotes large payloads or slow network throughput.

DNS lookup time for the API URL

Indicates the time taken to resolve the API domain name to an IP address.

Seconds

A high value for this measure may indicate potential DNS configuration issues or external resolver delays.

TCP connect time to the API URL

Indicates the time taken to establish a TCP connection with this API.

Seconds

A low value is desired for this measure.

Response code of the API

Indicates the HTTP status code returned by this API.

Number

 

Size of the API response

Indicates the total payload size of this API's response.

KB

 

Content matches configured for the API response

Indicates the number of expected validation rules configured for this API's response content.

Number

 

Content matches that succeeded for the API response

Indicates the number of successful content validations.

Number

 

API content match successes

Indicates the percentage of successful content validations.

Percent

A value of 100% indicates that the content returned by the test is valid. A value of 0% indicates that the content may be invalid.

Content matches that failed in the API response

Indicates the number of failed content validation checks.

Number

A low value is desired for this measure.

API content match failures

Indicates the percentage of failed content validation checks.

Percent

A low value is desired for this measure.

Configuring REST APIs for Monitoring

To configure REST APIs for monitoring, do the following:

  1. Click on the Configure Icon icon alongside the CONFIGURED APIs text box in .

    Test Configuration of REST API Health Test

    Figure 1 : Test configuration parameters of REST API Health Test

  2. then appears.

    Sites Config

    Figure 2 : The SITES CONFIG window

    In Figure 2, specify the following:

    Name - Specify a unique name by which the API you will be specifying shortly will be referred to across the eG user interface. This is the name that will appear as the descriptor of this test.

    URL - Enter the URL of the API that this test should access.

    Method - Select the HTTP request method used to access the API. Supported methods include GET, POST, PUT, and HEAD, depending on the API operation being monitored.

  3. By default, the Connections tab is displayed in the SITES CONFIG window where you need to specify the following in the Connection Details section:

    Parameter Description

    Timeout

    Specify the maximum time the test should wait for the specified API to respond before the request is considered timed out. By default, this parameter is set to 250ms.

    Proxy IP

    By default, none is set for this parameter. If the API requests are routed through a proxy server, then specify the IP address of the proxy server here.

    Proxy Port

    Specify the port number on which the proxy server is listening. This parameter is applicable only when a proxy server is configured.

    Proxy User

    This parameter is applicable only when the proxy server required authentication. Specify the username required to authenticate with the proxy server. By default, this parameter is set to none.

    Proxy Password

    This parameter is applicable only when the proxy server required authentication. Specify the password associated with the specified user. By default, this parameter is set to none.

    Re-attempts

    Specify the number of times the test should retry the API request if the initial attempt fails due to a connection or network error.

    In the System Properties section, specify Property and Value of the configured URL, if required. By default, none is specified in these text boxes. Some URLs configured for monitoring may require specific system properties to be set before they can be accessed successfully. In such cases, configure the required properties using the Property and Value fields in the System Properties section; otherwise, the connection attempt may fail. For example, if the monitored REST API is accessible only through an HTTPS proxy, specify https.proxyHost in the Property field and the proxy host name (for example, proxy.example.com) in the Value field. If required, add another Property pair, such as https.proxyPort and 8443, by clicking the encircled plus icon next to the Value field. Similarly, if a property accepts multiple values, specify them as a comma-separated list in the Value field. To remove a system property, click on the Delete icon corresponding to it.

  4. Next, click the Params tab to configure the values (see Figure 3).

    Params Tab

    Figure 3 : The Params tab

    The Params tab allows you to add query parameters as key:value pairs that are appended to the API request URL. You can add or remove parameters using the encircled '+' and encircled '-' icons. By specifying appropriate parameters, you can retrieve only the required data, making API calls more efficient and reducing unnecessary data transfer.

  5. The Authorization tab (see Figure 4) allows you to select the authorization method required to access the configured API.

    Authorization Tab

    Figure 4 : The Authorization tab

    Most APIs require authentication to prevent unauthorized access. Use the Authorization tab to specify the authentication method that the test should use when sending requests. Select the required authentication type from the drop-down list, such as No Auth, Basic Auth, JWT Auth, Bearer Token, or SSL Auth. Based on the selected authentication type, the corresponding configuration fields are displayed. For example, selecting Basic Auth displays the Username and Password fields as shown in Figure 5, while selecting Bearer Token displays the Token field. The configured authentication details are automatically included with every API request, ensuring secure communication with the target service.

    Selecting Basic Auth type in Authorization tab

    Figure 5 : Selecting Basic Auth type in the Authorization tab

  6. Next, the Headers tab in the Sites Config screen is used to configure the HTTP headers that are included with every REST API request. Headers provide additional information about the request or define how the client and server should communicate.

    Headers tab

    Figure 6 : The Headers tab

    This tab allows you to select a standard header name from the drop-down list, and specify its corresponding value. Multiple headers can be added or removed using the encircled '+' and encircled '–' icons.

  7. The Body tab is used to configure the request payload that is sent to the server as part of an HTTP request. The body is primarily used with methods such as POST, PUT, and PATCH to send data for creating or updating resources.

    Body tab

    Figure 7 : The Body tab

    The Body tab allows you to select the required body format based on the API requirements. By default, None is selected as shown in Figure 7 indicating that no body format is set by default. However, you can select the required format from the listed supported formats include form-data, x-www-form-urlencoded, and rawData.

    form-data : when this format is selected, data is sent as multipart key-value pairs and file uploads are supported along with text fields. This format is used when uploading documents or images.

    x-www-form-urlencoded : when this format is selected, data is sent as URL-encoded key-value pairs in the request body. This format is typically used for HTML form submissions and authentication requests.

    rawData : when this format is selected, the request body is sent as raw content, such as JSON, XML, or plain text. JSON is the widely used format in modern REST APIs. For example, if the rawData format is selected, the additional fields appear as shown below:

    Slecting rawData Format

    Figure 8 : Selecting the rawData format

  8. Use the Content Match tab to validate whether the monitored REST API returns the expected response content.

    Content Match

    Figure 9 : The Content Match tab

    First, selecting the expected content type from the drop-down list that lists the Text, JSON, and XML types. Based on the selected content type, the corresponding content-matching fields are displayed in Figure 9. For example, if you select Text as the content type, specify a meaningful name for the content-matching rule in the Provide a name for content matching criteria field. Then, select the comparison operator (such as equals, not equals, contains, starts with or ends with) from the Matching condition drop-down list and enter the expected value in the Actual String to be matched field. Select the Match case check box if the comparison should be case-sensitive. To configure additional matching conditions, click the encircled '+' icon. To remove an existing condition, click the Delete icon.