Java Project to download the iteration summary report / REST API to get report data.
How can we use our API to download iteration reports as CSV based on specific executions?
You can use our AppvanceRestClient.jar to get the iteration summary report downloaded to a directory of your choosing. For that, create a Java project adding the following dependencies:
1. AppvanceRestClient.jar
https://s3-us-west-2.amazonaws.com/appvance-rest-client/AppvanceRestClient.jar
2. Download this file and extract it. Add all .jars in this zip to your project library:
https://s3-us-west-2.amazonaws.com/appvance-rest-client/lib.zip
Also here is a sample main method which downloads a csv iteration summary report
package appvancerestclientdemo; import com.appvance.enterprise.rest.client.AppvanceRestClient; import org.json.JSONArray; public class AppvanceRestClientDemo { /* * this will save an iteration summary report in the directory specified. Can be windows or windows path. * look in line for comments on necessary arguments. * public static void main(String[] args) throws Exception { AppvanceRestClient arc = new AppvanceRestClient("http://localhost:8080"); // provide your Appvance IQ server dns or ip arc.logIn("appvance", "appvance"); String executionId = "1520546604589"; // get this id when you run your scenario in the output section, like "Execution ID = 1520548008690" String config = "default"; // this config refers to the database configuration used when running scenario, normally use "default" JSONArray iterationInfo = arc.getIterations(config, executionId); String iterId = iterationInfo.getJSONObject(0).getInt("id")+""; // gets the id of the fist iteration of your execution boolean status = arc.downloadSummaryReport("/Users/oscar/Documents/", config, executionId, iterId); // downloads the CSV or return false System.out.println("File download: "+status); } }
Note: Not all reports are accessible right now on this AppvaceRestClient.
REST API to get report data:
Following is the way using just the rest calls.
There has been added some concepts like summaryId, report template and offset that were not when the documentation was compiled. Following would be the list of calls necessary to get a CSV summary report.
Provided you are logged in and have the execution Id, following would be the list of calls necessary to get a CSV summary report.
1. GET SCENARIO ITERATIONS (from this response need the summaryId and the iterId as in attached image)
http://localhost:8080/AppvanceServer/rest/reports/getIterations?config=default&exeId=1520986267004
2. GET TICKS (take the bigger number, this are offset in secs where you can pull report, like a snapshot in time)
http://localhost:8080/AppvanceServer/rest/reports/getTicks?config=default&exeId=1520986267004&iterId=-1386405882
3. GET TEMPLATE NAME (normally can use default one "All Reports")
http://localhost:8080/AppvanceServer/rest/reports/getTemplateNames
4. GET SUMMARY REPORT
http://localhost:8080/AppvanceServer/rest/reports/getSummary?config=default&iterId=-1341233&summaryId=2171777&offset=180&template=All%20Reports