The example shows how to construct a condition request for the Response header Content-Type
has a value that ends with json
condition. To better understand the process, read descriptions of Conditions and Test catalog template in the Test Center concepts section.
To create a request that specifies the condition:
- Run the Get the test catalog template operation. The test catalog template's response object consists of the
conditionNodes
array and thetriggerMappings
object. This is a fragment of theconditionNodes
array for theconditionId
of1
.
{
"conditionNodeId": 1,
"conditionNodeDescription": "Root condition nodes",
"valueControls": {
"valueDataType": "string",
"valueInputType": "single_choice",
"newValueSupported": false,
"availableValues": [
"last_mile_acceleration",
"ignore_case_in_cache_key",
"origin_server_cache_key_hostname",
"sure_route",
"tiered_distribution",
"response_code",
"log_request_details",
"caching_option",
"variable",
"cp_code",
"redirect",
"prefetch_objects",
"response_header",
"cache_key_query_parameters"
]
}
}
- To create the condition, start from the
conditionNodes
array andconditionId
of1
of the test catalog template's response object. One of available values of the node isresponse_header
, which is the first element of the condition. Enter the values into the request body.
{
"condition": {
"conditionNodeId": 1,
"values": [
"response_header"
]
}
}
-
In the test catalog template's response object, check what are the values you can use next for the selected value of the node. Go to the
triggerMappings
array and find thetriggerValue
forresponse_header
. Check theconditionNodeId
forconditionNode
. This is the node triggered by the selection ofresponse_header
in the first node. In this case it's the node withconditionNodeId
of4
. -
In the test catalog template's response object, go back to the
conditionNodes
array andconditionNodeId
of4
. The description of the node states that it needs input from you. For this example it'sContent-Type
. Update the request body.
{
"condition": {
"conditionNodeId": 1,
"values": [
"response_header"
],
"conditionNode": {
"conditionNodeId": 4,
"values": [
"Content-Type"
]
}
}
}
-
Go back to the test catalog template's response object and the
triggerMappings
array to check which node is triggered next. The consecutiveconditionNodeId
is5
. -
The description of the node in the
conditionNodes
array in the test catalog template's response object states that it requires a single selection out of the provided values. For this example it'shas_a_value
. Update the request body. Because thevalidPath
forhas_a_value
istrue
you could finish the condition here, but then it would be just Response headerContent-Type
has a value.
{
"condition": {
"conditionNodeId": 1,
"values": [
"response_header"
],
"conditionNode": {
"conditionNodeId": 4,
"values": [
"Content-Type"
],
"conditionNode": {
"conditionNodeId": 5,
"values": [
"has_a_value"
]
}
}
}
}
- Go back to the
triggerMappings
array of the test catalog template's response object and check which node was triggered next by the selected value. The consecutiveconditionNodeId
is7
. The description of the node in theconditionNodes
array states that it requires a single selection out of the listed values. For this example it'sends_with
. Update the request body.
{
"condition": {
"conditionNodeId": 1,
"values": [
"response_header"
],
"conditionNode": {
"conditionNodeId": 4,
"values": [
"Content-Type"
],
"conditionNode": {
"conditionNodeId": 5,
"values": [
"has_a_value"
],
"conditionNode": {
"conditionNodeId": 7,
"values": [
"ends_with"
]
}
}
}
}
}
- Go back to the
triggerMappings
array of the test catalog template's response object and check which node was triggered next. Because there were several values from which you could choose, you need to findtriggerValue
forends_with
and find triggeredconditionNodeId
. It's4
. This node was used before, so you known that it requires a single input from you. For this example it'sjson
. Update the request body. The condition Response headerContent-Type
has a value that ends withjson
is ready. ThevalidPath
for the last node istrue
so the condition is finished. You can now use this as the POST request object when running the Create a condition operation.
{
"condition": {
"conditionNodeId": 1,
"values": [
"response_header"
],
"conditionNode": {
"conditionNodeId": 4,
"values": [
"Content-Type"
],
"conditionNode": {
"conditionNodeId": 5,
"values": [
"has_a_value"
],
"conditionNode": {
"conditionNodeId": 7,
"values": [
"ends_with"
],
"conditionNode": {
"conditionNodeId": 4,
"values": [
"json"
]
}
}
}
}
}
}