0

I use ajax jquery call to fetch data about tests from Jenkins test report's REST API. However, I want only those tests for which 'status' is not PASSED and FIXED. Now, can I configure my Ajax call such that this filtering is already done on the server side, so that passed tests are not returned as a part of the response ? My Ajax call so far :

    function getTestResultsForJob(jobTestResultsUrl){

        var listOfFailures = {};
        $.ajax({
            type: 'GET',
            dataType: 'json',
            url: jobTestResultsUrl,
            async: false,
            error: function() {
                alert("Request has failed for " + jobTestResultsUrl);
            },
            success: function(data){
                console.log('Request is success for ' + jobTestResultsUrl);
                listOfFailures = data;
            }
        });
        return listOfFailures;

    }

1 Answers1

0

It isn't possible to do such filtering with json on the server side.

The following returns the build numer and result:

job/Test/api/json?tree=builds[number,result]

And doing the filtering inside the success method of you ajax call.


If you can switch to xml the query would be like that:

job/Test/api/xml?tree=builds[number,result]&exclude=mavenModuleSet/build[result="PASSED"]
CSchulz
  • 10,882
  • 11
  • 60
  • 114