XML API tutorial: How to access scan results
This tutorial provides basic step-by-step information on how to use the Veracode Results API to automate the retrieval of application scan results using the HTTPie command-line tool. This guide uses standalone HTTP request calls, but you can combine them in an API wrapper to process multiple API calls.
Before you begin:
- Before you can access and use the APIs, your Veracode user account must have the required permissions.
- To authenticate with Veracode, ensure you have set up API authentication for HMAC or OAuth 2.0.
To complete this task:
-
From the command prompt, send the following request to get a list of application profiles in your portfolio. The returned
applist.xmlreturns a list of application IDs and names, such asapp app_id="18766"app_name="MyApp".Veracode HMAC authentication
http --auth-type=veracode_hmac "https://analysiscenter.veracode.com/api/5.0/getapplist.do"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
http --auth-type=oauth2-client-credentials-flow `--auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `--token-endpoint="$($env:VERACODE_TOKEN_URL)" `--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getapplist.do"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getapplist.do" -
Obtain the list of builds for your chosen application.
-
For policy scan results, send the following request, using the application ID returned in the previous step. The returned
buildlist.xmlfrom this step contains the IDs of the builds for this application.Veracode HMAC authentication
http --auth-type=veracode_hmac "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
http --auth-type=oauth2-client-credentials-flow `--auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `--token-endpoint="$($env:VERACODE_TOKEN_URL)" `--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>" -
For sandbox scan results, send the following request to obtain the IDs for your sandboxes, using the application ID returned in the previous step:
Veracode HMAC authentication
http --auth-type=veracode_hmac "https://analysiscenter.veracode.com/api/5.0/getsandboxlist.do" "app_id==<your application ID>"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
http --auth-type=oauth2-client-credentials-flow `--auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `--token-endpoint="$($env:VERACODE_TOKEN_URL)" `--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getsandboxlist.do" "app_id==<your application ID>"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getsandboxlist.do" "app_id==<your application ID>"When you have the ID for the chosen sandbox, send the following request to obtain the build IDs for that sandbox:
Veracode HMAC authentication
http --auth-type=veracode_hmac "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>" "sandbox_id==<your sandbox ID>"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
http --auth-type=oauth2-client-credentials-flow `--auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `--token-endpoint="$($env:VERACODE_TOKEN_URL)" `--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>" "sandbox_id==<your sandbox ID>"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/getbuildlist.do" "app_id==<your application ID>" "sandbox_id==<your sandbox ID>"
-
-
To obtain the detailed report for your chosen build, send. Where indicated, insert the ID for the target application build or sandbox scan. Locate the build ID from the
buildlist.xmlorsandboxlist.xmlreturned in the previous step.Veracode HMAC authentication
http --auth-type=veracode_hmac "https://analysiscenter.veracode.com/api/5.0/detailedreport.do" "build_id==<the policy or sandbox build ID>"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
http --auth-type=oauth2-client-credentials-flow `--auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `--token-endpoint="$($env:VERACODE_TOKEN_URL)" `--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/detailedreport.do" "build_id==<the policy or sandbox build ID>http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic "https://analysiscenter.veracode.com/api/5.0/detailedreport.do" "build_id==<the policy or sandbox build ID>