REST API for retrieving audit snapshots

9.2.38 Available from 9.2.38.

You can use the GET operation on the restapi/v2/audit_snapshot element to generate the audit snapshot.

Enabling REST API in upgraded License Metric Tool

  • If you upgraded to application update 9.2.38, REST API for retrieving audit snapshots is not enabled by default. To enable the REST API, edit the web.xml file. For more information, see: Enabling REST API for retrieving audit snapshots in upgraded License Metric Tool.
  • If you upgraded to application update 9.2.38.1 or later, the REST API is enabled by default and you do not need to perform this procedure.

Permissions

An icon representing a user. You must have the View License Metric and View Audit Trail permissions to perform this task.

Resource URL

https://server_url:server_port/restapi/v2/audit_snapshot

Resource information

Table 1. Resource information
Operation details Description
HTTP method GET
Request headers
Accept-Language (optional)
  • Use: Used to negotiate the language of the response. If this header is not specified, the content is returned in the server language.
  • Values: en-US (only English is supported)
Token
  • Use: Used to authenticate REST API requests. The header is required when you set the value of the api_token_in_url_enabled parameter to false. Otherwise, you can specify the token in the request header or in the URL. For more information, see: Authenticating REST API requests.
  • Values: an alphanumeric string that is generated in License Metric Tool
Request format application/json
Response headers
Content-Type
  • Use: Specifies the content type of the response.
  • Values: application/json
Content-Language
  • Use: Specifies the language of the response content. If this header is not specified, the content is returned in the server language.
  • Values: en-US, …
Response payload Compressed ZIP file.
Response format application/octet-stream
Response codes

200 – “Successfully extracted audit snapshot”

400 – “Bad request” if a query parameter contains errors or is missing.

401 – “Unauthorized” if you are not authorized for this operation.

409 – “Conflict” if the import is in progress and thus the audit snapshot cannot be generated

Query parameters

Table 2. Query parameters
Parameter Description Required Value
startdate Start date of the audit snapshot in the YYYY-MM-DD format. String
enddate End date of the audit snapshot in the YYYY-MM-DD format. String
computerGroupId Identifier of the computer group for which the audit snapshot is generated. If the computer group is not provided, the snapshot is generated for the computer group to which the user is assigned.   String
reportId Identifier of the saved report view of the All Metrics report for which you want to generate the audit snapshot. If the ID is not provided, the report is generated for the whole All Metrics report.   String
comment Comment that you want to include in the audit snapshot. Only ASCII characters are accepted. Spaces need to be escaped by using the %20 or +, for example:
  • comment=Comment%20with%20spaces
  • comment=Comment+with+space
  String
locale Locale of the audit snapshot. If not locale is provided, the snapshot is generated in en-US.  
  • cs-CZ
  • de-DE
  • en-US
  • es-ES
  • fr-FR
  • hr-HR
  • hu-HU
  • it-IT
  • ja-JP
  • ko-KR
  • nl-NL
  • pl-PL
  • pt-BR
  • sl-SI
  • zh-CN
  • zh-TW
obfuscate Indicates whether sensitive data including server names, computer names, and IP addresses should be obfuscated in the audit snapshot. By default, the data is not obfuscated.
Note: If you want to include a file that allows to de-obfuscate the data in the audit snapshot, set the value of the include_mapping_file_to_obfuscated_audit_snapshot_report parameter to True on the Advanced Server Settings panel.
 
  • true
  • false

Example conversation with the minimal set of parameters

The following example shows how to generate the audit snapshot by providing the minimal set of required parameters: start date and end date. The example conversation uses cURL commands. You can use a different method of making REST API calls.
Request
  1. To generate the audit snapshot, use the following GET request.
curl -X GET -k -J -O -H "Token: token" "https://server_url:server_port/restapi/v2/audit_snapshot?
startdate=2024-07-13&enddate=2024-10-11" -s -D -
Where:
-X
Specifies the type of the HTTP request.
-k
Use this option to disable License Metric Tool certificate verification procedure.
-J -O
Indicates that the name of the file with the audit snapshot will be based on the information that is returned in the Content-Disposition element: audit_snapshot_timestamp.zip
-H
Specifies the header of the request.
-s
Indicates that the progress of creating the file is not shown.
-D -
Indicates that the response status is returned.
token
Specifies the token that is used to authenticate REST API requests.
Response
Important: The audit snapshot cannot be generated during the import. If generating the snapshot is triggered during the import, the 409 error is returned. The generated file does not have the .zip extension and cannot be used.
HTTP/1.1 200 OK
Strict-Transport-Security: max-age=31536000
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="audit_snapshot_2024-10-23_15-00-51.625.zip"
Content-Length: 157904
Content-Language: en-US
Date: Wed, 23 Oct 2024 15:00:51 GMT

Example conversation with additional parameters

The following example shows how to generate the audit snapshot for a specific saved report view of the All Metrics report, and for a selected computer group. The example conversation uses cURL commands. You can use a different method of making REST API calls.
Request
  1. To obtain the ID of the report view for which you want to generate the snapshot, perform the following steps.
    1. Log in to License Metric Tool, hover over Reports, and click Saved Reports.
    2. Hover over Configure, and click Configure View.
    3. Select ID, and click Submit. ID of the saved report view is provided in the ID column.
  2. To obtain the ID of the computer group for which you want to generate the snapshot, perform the following steps.
    1. In the top navigation bar, hover over Reports, and click Computer Groups.
    2. Hover over Configure, and click Configure View.
    3. Select ID, and click Submit. ID of the computer group is provided in the ID column.
  3. To generate the audit snapshot, use the following GET request.
    curl -X GET -k -J -O -H "Token: token" "https://server_url:server_port/restapi/v2/audit_snapshot?
    startdate=2024-07-13&enddate=2024-10-11" -s -D -
    Where:
    -X
    Specifies the type of the HTTP request.
    -k
    Use this option to disable License Metric Tool certificate verification procedure.
    -J -O
    Indicates that the name of the file with the audit snapshot will be based on the information that is returned in the Content-Disposition element: audit_snapshot_timestamp.zip
    -H
    Specifies the header of the request.
    -s
    Indicates that the progress of creating the file is not shown.
    -D -
    Indicates that the response status is returned.
    token
    Specifies the token that is used to authenticate REST API requests.
Response
HTTP/1.1 200 OK
Strict-Transport-Security: max-age=31536000
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="audit_snapshot_2024-10-23_15-00-51.625.zip"
Content-Length: 157904
Content-Language: en-US
Date: Wed, 23 Oct 2024 15:00:51 GMT