Syntax to Filter for Latest Execution of a Configuration

POST /core/health-query-tasks submits a request for the latest execution of a configuration.

Input

Use the supported input parameters to control the command output.

Parameter Description
URL https://$vRA:8090/core/health-query-tasks
$vRA

Specifies the appliance name and fully qualified domain name, or IP address of the vRealize Automation server.

$healthtoken Specifies a valid authentication token for the health services API.
Note: The request does not use the API endpoint so healthbroker-proxy-service/api is not used.

Response Status Codes

One of the following codes is displayed as a result of your synchronization request.

Status Code Description
200 OK Your request succeeded and the object was updated.
400 BAD REQUEST The data you provided in the POST failed validation. Inspect the response body for details.
401 UNAUTHORIZED The request might not authenticate the user or authentication credentials required.

curl Command to Filter for Latest Execution of a Configuration

The following example command retrieves the latest execution of the configuration named /health/config/configurations/12858d4c34f278755680551b52340.
curl -X --insecure -H "content-type: application/json" -H "x-xenon-auth-token: $healthtoken" https://$vRA:8090/core/health-query-tasks
{
    "taskInfo": {
        "isDirect": true
    },
    "querySpec": {
        "query": {
            "occurance": "MUST_OCCUR",
            "booleanClauses": [{
                "occurance": "MUST_OCCUR",
                "term": {
                    "propertyName": "documentKind",
                    "matchValue": "com:vmware:healthbroker:states:ExecutionServiceState",
                    "matchType": "TERM"
                }
            },
            {
                "occurance": "MUST_OCCUR",
                "term": {
                    "propertyName": "configurationLink",
                    "matchValue": "/health/config/configurations/12858d4c34f278755680551b52340",
                    "matchType": "TERM"
                }
            }]
        },
        "sortTerm": {
            "propertyName": "startedTimestamp",
            "propertyType": "LONG"
        },
        "sortOrder": "DESC",
        "resultLimit": 1,
        "options": ["TOP_RESULTS",
        "EXPAND_CONTENT",
        "SORT"]
    }
}

JSON Output

The following sample shows the latest execution of the configuration specified by the overallResultsLink.
{
    "taskInfo": {
    ...
    },
    "querySpec": {
        "query": {
        ...
        }
    },
    "results": {        
       "documentLinks": [            
           "/health/exec/executions/12858d4c34f278755680551d322f0"        
       ],        
    "documents": {            
        "/health/exec/executions/12858d4c34f278755680551d322f0": {                
            "configurationLink": "/health/config/configurations/12858d4c34f278755680551b52340",                
            "started": "2018-03-22T19:29:00.471Z",                
            "overallResultsLink": "/health/result/overall-results/Report_089adaf3-44d3-4cb2-a1a5-d2de4f376e73-20180322-19.29.00.0471",                
     
        ...
        },
    ...
    },
}