Examples¶
Here are examples of getting a particular report.
Get a Specified Report¶
Request using the ‘curl’ command:
curl -X GET \
-H "Token:eda4d4d4703937d6bb479n296a0d6c21d215b81d" \
–H "Accept:application/xml" \
"https://secure.cigital.com/api/public/v3/reports/REPORT_1328267029"
Request using an Apache Groovy script:
// NOTE: Environment (env) and other variables have to be
// defined beforehand..
// The downloaded report will be available in the Jenkins path
// where it is executed.
def report_content = httpRequest ignoreSslErrors: false,\
quiet: true,outputFile: env.TestId+'.'+ReportType,\
url:"${env.hostURL}/api/public/v3/reports/"+report_id,\
httpMode: 'GET',customHeaders:[[name:'token',value:"${env.token}"]]
// NOTE: If you would like to print a report as XML or CSV,
// you can use "println(report_content.content)".
// However, printing the report as PDF is not supported.
Request using Java source code:
public void printReportInfo( String reportId ) {
Client client = ClientBuilder.newClient();
WebTarget target =
client.target( MSP_URL )
.path( "/api/public/v3/reports/" + reportId );
Response response =
target.request().header( "token", MSP_TOKEN )
.accept( MediaType.APPLICATION_XML_TYPE )
.get(Response.class);
if ( response.getStatus() == 200 ) {
System.out.println( response.readEntity( String.class ) );
} else {
System.out.println( response.readEntity( String.class ) );
}
client.close();
}
Response:
Status: 200
Response Body:
<MSPortalXmlReport>
<version>1.0</version>
<generatedAt>YYYY-MM-DDTHH:MM:SS.sssz</generatedAt>
<vulnerabilities>
<vulnerability>
<title>Access Control (Authorization) Issues</title>
<systemic>YES</systemic>
<severity>Critical</severity>
<impactDescription>sample impact summary</impactDescription>
<summary>Sample Summary</summary>
<description>test description</description>
<recommendation>test recommendation</recommendation>
...
</vulnerability>
</vulnerabilities>
</MSPortalXmlReport>
Parent topic:Get Individual Report