Skip to content

Audit Service v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Audit logging microservice

Base URLs:

Authentication

  • HTTP Authentication, scheme: bearer

AuditController

AuditController.archive

Code samples

const inputBody = '{
  "date": {
    "fromDate": "2023-01-01T00:00:00.000Z",
    "toDate": "2023-01-01T00:00:00.000Z"
  },
  "deleted": true,
  "entityId": "string",
  "actedOn": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/archive',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
  "date": {
    "fromDate": "2023-01-01T00:00:00.000Z",
    "toDate": "2023-01-01T00:00:00.000Z"
  },
  "deleted": true,
  "entityId": "string",
  "actedOn": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/archive',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /audit-logs/archive

Permissions
ArchiveLogs
6

Body parameter

1
2
3
4
5
6
7
8
9
{
  "date": {
    "fromDate": "2023-01-01T00:00:00.000Z",
    "toDate": "2023-01-01T00:00:00.000Z"
  },
  "deleted": true,
  "entityId": "string",
  "actedOn": "string"
}

Parameters

Name In Type Required Description
body body CustomFilter false none

Example responses

200 Response

1
2
3
4
5
{
  "message": "string",
  "numberOfEntriesArchived": 0,
  "file": "string"
}

Responses

Status Meaning Description Schema
200 OK Archive logs status Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» message string false none none
» numberOfEntriesArchived number false none none
» file string false none none

AuditController.count

Code samples

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/count',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/count',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /audit-logs/count

Permissions
ViewAudit
1

Parameters

Name In Type Required Description
where query object false none

Example responses

200 Response

1
2
3
{
  "count": 0
}

Responses

Status Meaning Description Schema
200 OK AuditLog model count loopback.Count

AuditController.export

Code samples

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/export',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/export',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /audit-logs/export

Permissions
ExportLogs
5

Parameters

Name In Type Required Description
includeArchivedLogs query boolean false none
filter query audit_logs.Filter false none

Example responses

200 Response

1
2
3
4
{
  "jobId": "string",
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK Responds with jobId if includeArchiveLogs is true or the success message otherwise. Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» jobId string false none none
» message string false none none

AuditController.jobStatus

Code samples

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/jobs/{jobId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/jobs/{jobId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /audit-logs/jobs/{jobId}

Permissions
ViewAudit
1

Parameters

Name In Type Required Description
jobId path string true none

Example responses

200 Response

[
  {
    "id": "string",
    "status": "string",
    "operation": "string",
    "tenantId": "string",
    "filterUsed": {},
    "result": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Array of AuditLog model instances Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [JobWithRelations] false none [(tsType: JobWithRelations, schemaOptions: { includeRelations: true })]
» JobWithRelations JobWithRelations false none (tsType: JobWithRelations, schemaOptions: { includeRelations: true })
»» id string false none none
»» status string true none none
»» operation string false none none
»» tenantId string true none none
»» filterUsed object false none none
»» result string false none none

AuditController.findById

Code samples

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /audit-logs/{id}

Permissions
ViewAudit
1

Parameters

Name In Type Required Description
id path string true none
filter query audit_logs.Filter1 false none

Example responses

200 Response

{
  "id": "string",
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "tenantId": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

Responses

Status Meaning Description Schema
200 OK AuditLog model instance AuditLogWithRelations

AuditController.create

Code samples

const inputBody = '{
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /audit-logs

Permissions
CreateAudit
2

Body parameter

{
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

Parameters

Name In Type Required Description
body body NewAuditLog false none

Example responses

200 Response

{
  "id": "string",
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "tenantId": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

Responses

Status Meaning Description Schema
200 OK AuditLog model instance AuditLog

AuditController.find

Code samples

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/audit-logs',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /audit-logs

Permissions
ViewAudit
1

Parameters

Name In Type Required Description
includeArchivedLogs query boolean false none
filter query audit_logs.Filter false none

Example responses

200 Response

[
  {
    "id": "string",
    "action": "string",
    "actedAt": "2019-08-24T14:15:22Z",
    "actedOn": "string",
    "actionKey": "string",
    "entityId": "string",
    "actor": "string",
    "tenantId": "string",
    "before": {},
    "after": {},
    "actionGroup": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Array of AuditLog model instances Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [AuditLogWithRelations] false none [(tsType: AuditLogWithRelations, schemaOptions: { includeRelations: true })]
» AuditLogWithRelations AuditLogWithRelations false none (tsType: AuditLogWithRelations, schemaOptions: { includeRelations: true })
»» id string false none none
»» action string true none none
»» actedAt string(date-time) true none none
»» actedOn string false none none
»» actionKey string true none none
»» entityId string true none none
»» actor string true none none
»» tenantId string true none none
»» before object false none none
»» after object false none none
»» actionGroup string false none none

Schemas

AuditLog

{
  "id": "string",
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "tenantId": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

AuditLog

Properties

Name Type Required Restrictions Description
id string false none none
action string true none none
actedAt string(date-time) true none none
actedOn string false none none
actionKey string true none none
entityId string true none none
actor string true none none
tenantId string true none none
before object false none none
after object false none none
actionGroup string false none none

NewAuditLog

{
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

NewAuditLog

Properties

Name Type Required Restrictions Description
action string true none none
actedAt string(date-time) true none none
actedOn string false none none
actionKey string true none none
entityId string true none none
actor string true none none
before object false none none
after object false none none
actionGroup string false none none

JobWithRelations

1
2
3
4
5
6
7
8
{
  "id": "string",
  "status": "string",
  "operation": "string",
  "tenantId": "string",
  "filterUsed": {},
  "result": "string"
}

JobWithRelations

Properties

Name Type Required Restrictions Description
id string false none none
status string true none none
operation string false none none
tenantId string true none none
filterUsed object false none none
result string false none none

AuditLogWithRelations

{
  "id": "string",
  "action": "string",
  "actedAt": "2019-08-24T14:15:22Z",
  "actedOn": "string",
  "actionKey": "string",
  "entityId": "string",
  "actor": "string",
  "tenantId": "string",
  "before": {},
  "after": {},
  "actionGroup": "string"
}

AuditLogWithRelations

Properties

Name Type Required Restrictions Description
id string false none none
action string true none none
actedAt string(date-time) true none none
actedOn string false none none
actionKey string true none none
entityId string true none none
actor string true none none
tenantId string true none none
before object false none none
after object false none none
actionGroup string false none none

CustomFilter

1
2
3
4
5
6
7
8
9
{
  "date": {
    "fromDate": "2023-01-01T00:00:00.000Z",
    "toDate": "2023-01-01T00:00:00.000Z"
  },
  "deleted": true,
  "entityId": "string",
  "actedOn": "string"
}

CustomFilter

Properties

Name Type Required Restrictions Description
date object false none none
» fromDate string false none none
» toDate string false none none
deleted boolean false none none
entityId string false none none
actedOn string false none none

loopback.Count

1
2
3
{
  "count": 0
}

loopback.Count

Properties

Name Type Required Restrictions Description
count number false none none

audit_logs.Filter

{
  "offset": 0,
  "limit": 100,
  "skip": 0,
  "order": "string",
  "where": {},
  "fields": {
    "id": true,
    "action": true,
    "actedAt": true,
    "actedOn": true,
    "actionKey": true,
    "entityId": true,
    "actor": true,
    "tenantId": true,
    "before": true,
    "after": true,
    "actionGroup": true
  }
}

audit_logs.Filter

Properties

Name Type Required Restrictions Description
offset integer false none none
limit integer false none none
skip integer false none none
order any false none none

oneOf

Name Type Required Restrictions Description
» anonymous string false none none

xor

Name Type Required Restrictions Description
» anonymous [string] false none none

continued

Name Type Required Restrictions Description
where object false none none
fields any false none none

oneOf

Name Type Required Restrictions Description
» anonymous object false none none
»» id boolean false none none
»» action boolean false none none
»» actedAt boolean false none none
»» actedOn boolean false none none
»» actionKey boolean false none none
»» entityId boolean false none none
»» actor boolean false none none
»» tenantId boolean false none none
»» before boolean false none none
»» after boolean false none none
»» actionGroup boolean false none none

xor

Name Type Required Restrictions Description
» anonymous [string] false none none

audit_logs.Filter1

{
  "offset": 0,
  "limit": 100,
  "skip": 0,
  "order": "string",
  "fields": {
    "id": true,
    "action": true,
    "actedAt": true,
    "actedOn": true,
    "actionKey": true,
    "entityId": true,
    "actor": true,
    "tenantId": true,
    "before": true,
    "after": true,
    "actionGroup": true
  }
}

audit_logs.Filter

Properties

Name Type Required Restrictions Description
offset integer false none none
limit integer false none none
skip integer false none none
order any false none none

oneOf

Name Type Required Restrictions Description
» anonymous string false none none

xor

Name Type Required Restrictions Description
» anonymous [string] false none none

continued

Name Type Required Restrictions Description
fields any false none none

oneOf

Name Type Required Restrictions Description
» anonymous object false none none
»» id boolean false none none
»» action boolean false none none
»» actedAt boolean false none none
»» actedOn boolean false none none
»» actionKey boolean false none none
»» entityId boolean false none none
»» actor boolean false none none
»» tenantId boolean false none none
»» before boolean false none none
»» after boolean false none none
»» actionGroup boolean false none none

xor

Name Type Required Restrictions Description
» anonymous [string] false none none