Sample 1: Sample Script Written using JavaScript

These samples provide an example of what you can do with the Application Security Management REST APIs.

Before you begin

Download the json2.js helper library from https://github.com/douglascrockford/JSON-js.

About this task

Here is the sample zip file to download and use: ASM_API_Samples_Javascript.zip. (If file doesn't download, right-click the link and save the file to your hard disk drive.) These are the sample scripts included in the zip file:
  • asm_api_summaries_issues_appfilter.js: This example shows how to log in, get basic summary information about issues using application attributes as part of the query, and log out.
  • asm_api_summaries_issues_daterange.js: This example shows how to log in, get basic summary information about issues using a date range query, and log out.
  • asm_sample_avg_issues_found_per_app_by_month.js: This example demonstrates a way to get the average number of issues found per application by month.
  • asm_sample_count_issues_by_app_over_time.js: This example demonstrates a way to enumerate, month by month, the list of applications for which new issues have been discovered.
  • asm_sample_overdue_issues.js: This example demonstrates a way to identify 'Overdue Issues'.

Procedure

  1. Unzip the samples zip file anywhere on your hard drive. Then copy the json2.js helper library into the .\\3rdParty\\json2.js sub-folder.
  2. Edit the _your_connection_info.js file to specify the location of your AppScan Enterprise Server and the user credentials.
    Note: The common_functions.js file contains shared functions used by the various samples. Do not run it directly.
  3. Run any of the other asm_xxxxx.js files by using cscript from the command line. For example, c:/> cscript asm_api_summaries_issues_appfilter.js.
  4. Alternatively, double-click the runAll.bat file to run all of the samples.