Difference between revisions of "Audit Web Service"

From FMR Knowledge Base
Jump to navigation Jump to search
m (Vmurrell moved page Audit REST API - FMR to Audit REST API)
(Download the Logs event for an Audit event)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:FMR_REST_API_Reference]]
 
[[Category:FMR_REST_API_Reference]]
 +
= Overview =
 +
The Audit web service can be used to query for audited events in the Fusion Metadata Registry
  
To be written.
+
= Querying Audits =
 +
 
 +
Returns a JSON Array of all of the structures in the Registry, filterable by parameter.
 +
 
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b> || style="min-width:500px;" | <b> /ws/secure/audit/searchAudits</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b> || <span style='color:red'><b>Restricted (Agency and Admin users only)</b></span>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b> || GET
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b> || application/json (array  of objects) see [[#Audit JSON]]
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b> || <p><b>200</b> - Query Ok<p>
 +
|}
 +
 
 +
=== HTTP Query Parameters ===
 +
If no parameters are supplied the last 500 audited events are returned
 +
 
 +
{| class="wikitable"
 +
|-
 +
!| Request Parameter || Purpose
 +
|-
 +
|style="background-color:#eaecf0"|<b>dateFrom</b> || The earliest audit event to return. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
 +
|-
 +
|style="background-color:#eaecf0"|<b>dateTo</b> || The latest audit event to return. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
 +
|-
 +
|style="background-color:#eaecf0"|<b>max</b> || The maximum number of audits to return, must be a positive integer, the default is 500 if not specified
 +
|-
 +
|style="background-color:#eaecf0"|<b>type</b> || The category of audit: <ol><li>Structure Query</li><li>Structure Submission</li><li>Data Query</li></ol>
 +
|-
 +
|style="background-color:#eaecf0"|<b>orderDesc</b> || true to order by time descending order, false to order ascending. The default output is that Transactions are returned in a descending order (most recent first)
 +
|-
 +
|style="background-color:#eaecf0"|<b>user</b> || username of the user that caused the audit event
 +
|}
 +
 
 +
= Query the Audit event for a Transaction =
 +
This web service is used to obtain a specific audit event for a transaction (a transaction is where the Registry updates either structural metadata, or a data registration).
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b> || style="min-width:500px;" | <b> /ws/secure/audit/getDetailsByTransactionId</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b> || <span style='color:red'><b>Restricted (Agency and Admin users only)</b></span>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b> || GET
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b> || application/json see [[#Audit JSON]]
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b> || <p><b>200</b> - Query Ok<p>
 +
|}
 +
 
 +
=== HTTP Query Parameters ===
 +
 
 +
{| class="wikitable"
 +
|-
 +
!| Request Parameter || Purpose
 +
|-
 +
|style="background-color:#eaecf0"|<b>txId</b> || The transaction ID (see the [[RSS_Feed|RSS]] feed)
 +
|}
 +
 
 +
= Download the Logs event for a Transaction =
 +
This web service is used to obtain a the log events for a transaction (a transaction is where the Registry updates structural metadata).
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b> || style="min-width:500px;" | <b> /ws/secure/audit/downloadLogsForTransaction</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b> || <span style='color:red'><b>Restricted (Agency and Admin users only)</b></span>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b> || GET
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b> || application/octet-stream
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b> || <p><b>200</b> - Query Ok<p>
 +
|}
 +
 
 +
=== HTTP Query Parameters ===
 +
 
 +
{| class="wikitable"
 +
|-
 +
!| Request Parameter || Purpose
 +
|-
 +
|style="background-color:#eaecf0"|<b>txId</b> || The transaction ID (see the [[RSS_Feed|RSS]] feed)
 +
|}
 +
 
 +
= Download the Logs event for an Audit event =
 +
This web service is used to obtain a the log events for a transaction (a transaction is where the Registry updates structural metadata).
 +
{| class="wikitable"
 +
|-
 +
|style="background-color:#eaecf0"|<b>Entry Point</b> || style="min-width:500px;" | <b> /ws/secure/audit/downloadLogsForAudit</b>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Access</b> || <span style='color:red'><b>Restricted (Agency and Admin users only)</b></span>
 +
|-
 +
|style="background-color:#eaecf0"|<b>Http Method</b> || GET
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Format</b> || application/octet-stream
 +
|-
 +
|style="background-color:#eaecf0"|<b>Response Statuses</b> || <p><b>200</b> - Query Ok<p>
 +
|}
 +
 
 +
=== HTTP Query Parameters ===
 +
 
 +
{| class="wikitable"
 +
|-
 +
!| Request Parameter || Purpose
 +
|-
 +
|style="background-color:#eaecf0"|<b>uid</b> || The unique audit Id (UID) see [[#Audit_JSON]]
 +
|}
 +
 
 +
= Audit JSON =
 +
Each audit event is output a JSON Object which contains the following information
 +
 +
  {
 +
    "UID": "52731504-0273-4f5c-a9e6-bb64bfd27574",
 +
    "Type": "Data Query",
 +
    "ServerName": "yourserver.com",
 +
    "VMID": "12b597ceb123456:1c12c34:123bc3bfe61:-8000",
 +
    "MachineId": "ip-11-2-3-44internal/11.2.3.44",
 +
    "ServerContext": "/FusionRegistry",
 +
    "ServletPath": "/ws/public/sdmxapi/rest",
 +
    "ServerPort": 443,
 +
    "PathInfo": "/data/WB,WDI_POVERTY,1.0",
 +
    "Parameters": "format=sdmx-json",
 +
    "Protocol": "HTTP/1.1",
 +
    "AcceptHeaders": "application/json, text/javascript, */*; q=0.01",
 +
    "AcceptLanguage": "en",
 +
    "SubmissionMethod": "GET",
 +
    "HttpResponseStatus": 200,
 +
    "RequestTime": 1615821933116,
 +
    "Duration": 6,
 +
    "Username": "anonymous",
 +
    "RequestIP": "111.222.33.44",
 +
    "ProductVersion": "10.6.6",
 +
    "UserAgent": "Chrome/89.0.4389.82 Safari/537.36",
 +
    "BrowserName": "Chrome",
 +
    "BrowserVersion": "89",
 +
    "OS": "Windows 10"
 +
  }

Latest revision as of 03:28, 27 March 2021

Overview

The Audit web service can be used to query for audited events in the Fusion Metadata Registry

Querying Audits

Returns a JSON Array of all of the structures in the Registry, filterable by parameter.

Entry Point /ws/secure/audit/searchAudits
Access Restricted (Agency and Admin users only)
Http Method GET
Response Format application/json (array of objects) see #Audit JSON
Response Statuses

200 - Query Ok

HTTP Query Parameters

If no parameters are supplied the last 500 audited events are returned

Request Parameter Purpose
dateFrom The earliest audit event to return. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
dateTo The latest audit event to return. The value must be specified as the epoch time in milliseconds (e.g. 1609459200000 is the start of the year 2021).
max The maximum number of audits to return, must be a positive integer, the default is 500 if not specified
type The category of audit:
  1. Structure Query
  2. Structure Submission
  3. Data Query
orderDesc true to order by time descending order, false to order ascending. The default output is that Transactions are returned in a descending order (most recent first)
user username of the user that caused the audit event

Query the Audit event for a Transaction

This web service is used to obtain a specific audit event for a transaction (a transaction is where the Registry updates either structural metadata, or a data registration).

Entry Point /ws/secure/audit/getDetailsByTransactionId
Access Restricted (Agency and Admin users only)
Http Method GET
Response Format application/json see #Audit JSON
Response Statuses

200 - Query Ok

HTTP Query Parameters

Request Parameter Purpose
txId The transaction ID (see the RSS feed)

Download the Logs event for a Transaction

This web service is used to obtain a the log events for a transaction (a transaction is where the Registry updates structural metadata).

Entry Point /ws/secure/audit/downloadLogsForTransaction
Access Restricted (Agency and Admin users only)
Http Method GET
Response Format application/octet-stream
Response Statuses

200 - Query Ok

HTTP Query Parameters

Request Parameter Purpose
txId The transaction ID (see the RSS feed)

Download the Logs event for an Audit event

This web service is used to obtain a the log events for a transaction (a transaction is where the Registry updates structural metadata).

Entry Point /ws/secure/audit/downloadLogsForAudit
Access Restricted (Agency and Admin users only)
Http Method GET
Response Format application/octet-stream
Response Statuses

200 - Query Ok

HTTP Query Parameters

Request Parameter Purpose
uid The unique audit Id (UID) see #Audit_JSON

Audit JSON

Each audit event is output a JSON Object which contains the following information

 {
   "UID": "52731504-0273-4f5c-a9e6-bb64bfd27574",
   "Type": "Data Query",
   "ServerName": "yourserver.com",
   "VMID": "12b597ceb123456:1c12c34:123bc3bfe61:-8000",
   "MachineId": "ip-11-2-3-44internal/11.2.3.44",
   "ServerContext": "/FusionRegistry",
   "ServletPath": "/ws/public/sdmxapi/rest",
   "ServerPort": 443,
   "PathInfo": "/data/WB,WDI_POVERTY,1.0",
   "Parameters": "format=sdmx-json",
   "Protocol": "HTTP/1.1",
   "AcceptHeaders": "application/json, text/javascript, */*; q=0.01",
   "AcceptLanguage": "en",
   "SubmissionMethod": "GET",
   "HttpResponseStatus": 200,
   "RequestTime": 1615821933116,
   "Duration": 6,
   "Username": "anonymous",
   "RequestIP": "111.222.33.44",
   "ProductVersion": "10.6.6",
   "UserAgent": "Chrome/89.0.4389.82 Safari/537.36",
   "BrowserName": "Chrome",
   "BrowserVersion": "89",
   "OS": "Windows 10"
 }