Audit configurations

This is the endpoint used to manage the configuration of the audit. Each document store and domain has a unique configuration only accessible by the administrators. Note however that normal users (non-admin) and retrieve the configuration as well as search for audit trails.

Get Audit Configurations

Retrieves the audit configuration for the specified document store or domain. Only users with normal rights (admin not required) on the respective document or domain can retrieve this information.

The configuration follows a key-value structure in which:

  • Only enabled events are present. That means if the key DOCUMENT_CREATE is not present, no audit trail for document creation wil be recorded.

  • Value for each event may be an identifier string or a JSON object with custom configuration for that event.

Parameters

Headers

Table 1. Headers
Name Example Description

Domain or Document-Store

If Domain: gds4et7gfds4h9ewjt1fds964f if Document-Store: invoice_store

This operation can be performed either in a domain or in a document store. Only one of these headers can be sent

Authorization

Bearer ha9r6DG4e5AQ84gferAd8EQ…​

Mandatory header of String type that authorizes you as the user with the right to execute this operation. The string is a Bearer Token returned from the operation create token

Responses

Success

Successful responses can be easily identified being always 20x (e.g. 200, 201).

Table 2. Success response
Field Example Description

Status code

200

OK

Content-Type

application/json

The Content-Type entity header is used to indicate the media type of the resource. In this case, it must be application/json

Body

JSON response

A JSON object containing the audit configuration

JSON response
{
  "author" : "john@company.com",
  "dateCreated" : "2018-10-24T07:10:51.709Z",
  "lastModifier" : "john@company.com",
  "dateModified" : "2018-10-26T09:15:55.980Z",
  "events": {
    "SEARCH": "SEARCH",
    "VERSION_DELETE": "VERSION_DELETE",
    "VERSION_METADATA_GET": "VERSION_METADATA_GET",
    "METADATA_GET": "METADATA_GET",
    "CATEGORY_GET": "CATEGORY_GET",
    "RETENTION_TEMPLATE_ADD": "RETENTION_TEMPLATE_ADD",
    "METADATA_UPDATE": "METADATA_UPDATE",
    "RETENTION_TEMPLATE_DELETE": "RETENTION_TEMPLATE_DELETE",
    "CATEGORY_DELETE": "CATEGORY_DELETE"
  }
}
Table 3. Response fields description
Field Example Description

documentStore/domain

invoice_store/gds4et7gfds4h9ewjt1fds964f

Identifier of the document store or domain for which the configuration is applied

events

Audit events

List of the operations that we want to audit

Table 4. Audit events
Entity Event Description

Document

DOCUMENT_CREATE

Creation of a new document

DOCUMENT_DELETE

Deletion of a document

Metadata

METADATA_GET

Retrieval of a document metadata

METADATA_UPDATE

Update of any field in the document metadata

CATEGORY_ADD

Addition of a category instance to a document metadata

CATEGORY_DELETE

Removal of a category instance to a document metadata

CATEGORY_GET

Retrieval of all document’s categories

Version

VERSION_GET

Retrieval of a version of a document

DOWNLOAD_VERSION

Transfer of a specific document version content to a client

VERSION_NEW

Creation of a content as a new version of a document

VERSION_UPDATE

Override of a document’s content by a new one

VERSION_DELETE

Removal of a version of a document

VERSION_SET_CURRENT

Modification of the current version of a document. That is, setting on of the already existing versions as current. No content is added, modified or removed

Search

SEARCH

Retrieval of a Document Metadata list searching by document content

Links

LINK_CREATE

Creation of a link to download the document version’s content

Users

USER_GET_DETAILS

Retrieval of user information

Login

TOKEN_CREATE

Token generation

TOKEN_REFRESH

Token refresh

Error

In case of error, the response body contains a JSON object with additional information:

  • span-id: auto-generated identifier of the request. Please provide this when asking for support in our forum.

  • message: descriptive message of the error. This is aimed for developers and is specially important for Bad Request errors., where contains hints on how to fix the request.

    Error messages should not be used to validate errors since they may be subject to change.
Example
{
  "span-id" : "7eb38962-2618-85f9-brte-4f15f6729590",
  "message" : "No match found for the Id"
}
Table 5. Error messages
Status code Message Description

400

Malformed JSON exception (line _, col _): …​

The JSON body has a bad structure. Message points where is the problem with line and column numbers as well as what is the problem (e.g. double "{", or a missing ",", …​)

401

The Token has expired on…​

Has passed more than an hour since the last create token or refresh token operation

401

Malformed token

The token sent is not valid

401

Problems parsing token

An empty token has been sent

401

The Document-Store header must be set

The header indicating the document store that you want to access, must be set

404

No match found for the Id

The document doesn’t exists in the specified Document Store

415

Content type _ not supported

The Content-Type header is not correctly set

500

Internal server error

If it happens consistently, please report it on our forum

Code examples

  • cURL

  • Java

  • Node.js

curl "https://api.everisbigcontent.com/edms/audit/v1/configurations" \
-X GET \
-H "Authorization: Bearer ha9r6DG4e5AQ84gferAd8EQ..." \
-H "Document-Store: invoice_store"
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

String url = "https://api.everisbigcontent.com/edms/rest/v1/configurations";
String token = "Bearer FEEA84g7gfhjt52wd5AFE4...";
String documentStore = "invoice_store";

HttpGet get = new HttpGet(url);
get.setHeader("Authorization", token);
get.setHeader("Document-Store", documentStore);

CloseableHttpClient client = HttpClients.createDefault();
CloseableHttpResponse execute = client.execute(get);
HttpEntity entity = execute.getEntity();

String jsonResponse = EntityUtils.toString(entity, StandardCharsets.UTF_8);
var request = require('request');
var token = 'Bearer FEEA84g7gfhjt52wd5AFE4...';
var documentStore = 'invoice_store';
request.get({
  headers: {
    'Authorization': token,
    'Document-Store': documentStore
  },
  url: 'https://api.everisbigcontent.com/edms/rest/v1/configurations'
}, function (error, response, body) {
  console.log(body);
});

Update Audit Configurations

Updates the audit configuration for the specified document store or domain. An user with admin role in the Document Store or Domain is needed to edit this configuration.

The configuration follows a key-value structure in which:

  • Only enabled events are present.

  • Value for each event may be an identifier string or a JSON object with custom configuration for that event.

Parameters

Headers

Table 6. Headers
Name Example Description

Domain or Document-Store

If Domain: gds4et7gfds4h9ewjt1fds964f if Document-Store: invoice_store

This operation can be performed either in a domain or in a document store. Only one of these headers can be sent

Authorization

Bearer ha9r6DG4e5AQ84gferAd8EQ…​

Mandatory header of String type that authorizes you as the user with the right to execute this operation. The string is a Bearer Token returned from the operation create token

Content-Type

application/json

The Content-Type entity header is used to indicate the media type of the resource. In this case, it must be application/json

Body

As indicated by headers, the body of the http request must be a JSON. The only field in which we need to send is the events field. The rest of properties will be omited cause they belong to traceable entities.

Table 7. Body json fields
Field Example Description

events

[audit-configurations-example]

List of the operations that we want to audit

Audit configurations Example
{
  "author" : "john@company.com",
  "dateCreated" : "2018-10-24T07:10:51.709Z",
  "lastModifier" : "john@company.com",
  "dateModified" : "2018-10-26T09:15:55.980Z",
  "events": {
    "SEARCH": "SEARCH",
    "VERSION_DELETE": "VERSION_DELETE",
    "VERSION_METADATA_GET": "VERSION_METADATA_GET",
    "METADATA_GET": "METADATA_GET",
    "CATEGORY_GET": "CATEGORY_GET",
    "RETENTION_TEMPLATE_ADD": "RETENTION_TEMPLATE_ADD",
    "METADATA_UPDATE": "METADATA_UPDATE",
    "RETENTION_TEMPLATE_DELETE": "RETENTION_TEMPLATE_DELETE",
    "CATEGORY_DELETE": "CATEGORY_DELETE"
  }
}
To explore about the possible values ​​of the events field you can read audit configurations.

Responses

Success

Successful responses can be easily identified being always 20x (e.g. 200, 201).

Table 8. Success response
Field Example Description

Status code

200

OK

Error

In case of error, the response body contains a JSON object with additional information:

  • span-id: auto-generated identifier of the request. Please provide this when asking for support in our forum.

  • message: descriptive message of the error. This is aimed for developers and is specially important for Bad Request errors., where contains hints on how to fix the request.

    Error messages should not be used to validate errors since they may be subject to change.
Example
{
  "span-id" : "7eb38962-2618-85f9-brte-4f15f6729590",
  "message" : "No match found for the Id"
}
Table 9. Error messages
Status code Message Description

400

Malformed JSON exception (line _, col _): …​

The JSON body has a bad structure. Message points where is the problem with line and column numbers as well as what is the problem (e.g. double "{", or a missing ",", …​)

400

Malformed JSON exception (line _, col _): Invalid UTF-8 middle byte…​

The encoding used to send the object was not UTF-8. This error can happen due to launching a curl in git-bash

401

The Token has expired on…​

Has passed more than an hour since the last create token or refresh token operation

401

Malformed token

The token sent is not valid

401

Problems parsing token

An empty token has been sent

401

The Document-Store header must be set

The header indicating the document store that you want to access, must be set

403

Unauthorized

We dont have access to that document store, or it is misspelled

404

No match found for the Id

The document doesn’t exists in the specified Document Store

415

Content type _ not supported

The Content-Type header is not correctly set

500

Internal server error

If it happens consistently, please report it on our forum

Code examples

  • cURL

  • Java

  • Node.js

curl "https://api.everisbigcontent.com/edms/audit/v1/configurations" \
-X POST \
-H "Authorization: Bearer ha9r6DG4e5AQ84gferAd8EQ..." \
-H "Document-Store: invoice_store" \
-H "Content-Type: application/json" \
-d '{"events": {"VERSION_NEW": "VERSION_NEW","RETENTION_TEMPLATE_UPDATE": "RETENTION_TEMPLATE_UPDATE"}}'
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

String url = "https://api.everisbigcontent.com/edms/rest/v1/configurations";
String token = "Bearer FEEA84g7gfhjt52wd5AFE4...";
String documentStore = "invoice_store";
String configurations = "{\"events\": {\"VERSION_NEW\": \"VERSION_NEW\",\"RETENTION_TEMPLATE_UPDATE\": \"RETENTION_TEMPLATE_UPDATE\"}}";

HttpPost post = new HttpPost(url);
post.setHeader("Authorization", token);
post.setHeader("Document-Store", documentStore);
post.setHeader("Content-Type", "application/json");

post.setEntity(new StringEntity(configurations));

HttpClient client = HttpClients.createDefault();
HttpResponse response = client.execute(post);

System.out.println(response.getStatusLine().getStatusCode());
var request = require('request');
var token = 'Bearer FEEA84g7gfhjt52wd5AFE4...';
var documentStore = 'invoice_store';
request.post({
  headers: {
    'Authorization': token,
    'Document-Store': documentStore,
    'Content-Type': 'application/json'
  },
  url: 'https://api.everisbigcontent.com/edms/rest/v1/configurations',
  json: {
    "events": {
      "VERSION_NEW": "VERSION_NEW",
      "RETENTION_TEMPLATE_UPDATE": "RETENTION_TEMPLATE_UPDATE"
    }
  }
}, function (error, response, body) {
   if (response.statusCode == 201) console.log("DONE");
});