You can leverage the Code Defender API to retrieve a variety of data about your application. Below are examples of how you can use the API for different scenarios.

Get all incidents in the past month for all applications

  1. Request the account's overall data. This returns an object with different account data. One of the fields, named applications, holds all the applications that were ever enabled on Code Defender.
curl --request GET \
     --url https://api-gw.perimeterx.com/v1/account-settings \
     --header 'accept: application/json'
  1. With the array from Step 1, you can extract all app_ids.
const appIds = accountSettingsresult.applications.map(application => application.app_id);
  1. After obtaining all relevant app Ids, you can easily request all incidents using start and end timestamps from the past month. This example shows timestamps for the full month of April 2023.
const incidentsPerAppId = Promise.All(
	appIds.map(appId => 
		fetch(
    	`https://api-gw.perimeterx.com/v1/incidents?appId=${appId}&tld=example.com&from=1680307200000&to=1682899199000&take=20&skip=0`, headers: { Authentication: 'Bearer ' } 
    )
  ) 
)