Custom attributes in the REST API and REST API Sequence monitors are the attributes that are fetched from the XML/JSON response of the REST API. To fetch these attributes, the XSLT Code or JSON Schema is defined and used to retrieve the attribute from the response, which can then be monitored.
You define custom attributes in the Response Details tab of the monitor. You can pick the values you want from the last API response, or write the XSLT code or JSON Schema yourself. Refer to the following topics:
If the response is of the JSON type, you can define specific values to be monitored using the JSON Schema. To do so, select JSON as the Response Type while adding/editing the monitor. Then click Add/View JSON Schema in the Response Details tab of the monitor and define the attributes to be monitored in the following format:
Syntax for JSON Schema
<AttributeName>::<Path to fetch the attribute>
To define specific attributes to be monitored, ensure that the following conditions are met:
The attribute should be defined as attributeName::attributeValue.
Example:Temperature::response.weather.temperature would create an attribute Temperature whose value will be the value of the temperature variable present in the API Response.
When you click Update JSON Schema, the defined attributes will be fetched and monitored along with their corresponding values in the table below, which can then be used to configure alarms, thresholds, and actions, and generate reports as well.
Example:
Let us consider the following API response code of JSON format which will be shown upon accessing the Response Details tab:
{ "response": { "result": [ { "responsecode": "200", "responsetime": "371 ms", "responsetimeinms": "371", "httpresponse": "OK", "httpmessage": "resource is up" } ] } }
Let's say you want to monitor the Response Code and Response Message attributes from the API response. To do so, click Add/View JSON Schema and define the attributes in the following format:
Response Code::response.result[0].responsecode Response Message::response.result[0].httpmessage
where,
Similarly, to fetch response object values, we can define as response.result[0] in the path which will fetch the response object values.
When you click Update JSON Schema, the attributes Response Code and Response Message will be monitored along with their corresponding values in the table, which can then be used to configure alarms, thresholds, actions, and generate reports as well.

Click Test to check the attributes (refer to Testing the schema), then save.
If the response is XML, you can define the values to be monitored using XSLT code. To do so, select XML as the Response Type while adding/editing the monitor. Then click Add/View XSLT Code in the Response Details tab of the monitor and define the attributes to be monitored in the following format:
Syntax for XSLT Code
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> attributename:<Path to fetch the attribute> </xsl:template> </xsl:stylesheet>
To define specific attributes to be monitored, ensure that the following conditions are met:
The output method should be of type 'text'.
<xsl:output method="text"/>
The final output of the path to fetch the attribute should be of the format attributeName:attributeValue.
Example:Days:<xsl:value-of select="days"/> would create an attribute 'Days' whose value will be the value of the <days> tag present in the API Response.
When you click Update XSLT Code, the defined attributes will be fetched and monitored along with their corresponding values in the table below, which can then be used to configure alarms, thresholds, and actions, and generate reports as well.
Example:
Let us consider the following API response code of XML format which will be displayed upon accessing the Response Details tab:
<xml> <result> <response response-code="200"> <response-time>256</response-time> <dns-time>18</dns-time> <response-size>10235</response-size> </response> </result> </xml>
Let's say you want to monitor the Response Code and Response Time attributes from the API response. To do so, click Add/View XSLT Code and define the attributes in the following format:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> ResponseCode:<xsl:value-of select="xml/result/response/@response-code"/> ResponseTime:<xsl:value-of select="xml/result/response/response-time"/> </xsl:template> </xsl:stylesheet>
where,
Similarly, to fetch the response node value, we can define it as xml/result/response in the path which will fetch the response node value.
When you click Update XSLT Code, the attributes ResponseCode and ResponseTime will be monitored along with their corresponding values in the table, which will then be used to configure alarms, thresholds, and actions, and generate reports as well.

Click Test to check the attributes (refer to Testing the schema), then save.
Instead of writing the paths yourself, you can pick the values to monitor from the last API response.

Click Test to try the schema on the last collected response before you save it. Nothing is saved.
The Test window lists each Attribute with its Value and Type (Numeric, Float or String), in the order of the schema. These are the attributes the next poll collects.
| Message | What to do |
|---|---|
| Data collection yet to start | Wait for the first poll of the monitor, then test again. |
| The schema did not produce any attribute | Check the paths in the schema against the response. |
| The XSLT could not be applied | Check that the XSLT code is complete and contains <xsl:output method="text"/>. |
It allows us to track crucial metrics such as response times, resource utilization, error rates, and transaction performance. The real-time monitoring alerts promptly notify us of any issues or anomalies, enabling us to take immediate action.
Reviewer Role: Research and Development