Annotator

Data Model

Data Model

Introduction

The service can save and manage the notes added from a Digital user related to one or more entities of external services. With the same model it is possible to represent even folders, groups of identifiers of external entities that have logical relationship between them. To use the service it is necessary a user token that is compatible with teamsystemId.

Data Model

Model

Annotation is the base model in which the entire service is based. It has the following format:

{
    "id": "string",
    "type": "string",
    "text": "string",
    "classification": "string",
    "referencing_date": "date",
    "reference_period": "string",
    "reference_type": "string",
    "reference_ids": [
      "string"
    ],
    "deleted": "boolean",
    "ownership": {
        "type": "string",
        "identifier": "string"
    },
    "item_classifier": "string",
    "inserted_by": "string",
    "inserted_at": "date",
    "modified_at": "date"
}

API

API

Get annotation

This API is responsible for retrieving the annotation with the given id.

[GET]/api/v1/annotations/{id}

Response: Annotation.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

Parameters used to make a successful request.

Body

No body is needed to make this request.

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "id": "string",
  "type": "string",
  "text": "string",
  "classification": "string",
  "referencingDate": "string",
  "referencePeriod": "string",
  "referenceType": "string",
  "referenceIds": [
    "string"
  ],
  "deleted": true,
  "ownership": {
    "type": "WS",
    "identifier": "string"
  },
  "itemClassifier": "string",
  "insertedBy": "string",
  "insertedAt": "2022-10-28T13:01:00.754Z",
  "modifiedAt": "2022-10-28T13:01:00.754Z"
}
On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are:

API

Create annotation

This API is responsible for creating an annotation.

[POST]/api/v1/annotations

Response: The id of the newly created annotation.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

No query parameters are needed to make this request.

Body

{
  "id": "string",
  "type": "string",
  "text": "string",
  "classification": "string",
  "ownership": {
    "type": "WS",
    "identifier": "string"
  },
  "referencing_date": "string",
  "reference_period": "string",
  "reference_type": "string",
  "reference_ids": [
    "string"
  ],
  "item_classifier": "string",
  "inserted_by": "string"
}

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "id": "string"
}
On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are:

API

Update annotation

This API is responsible for updating an annotation.

[PATCH]/api/v1/annotations/{id}

Response: The id of the updated annotation.

The update operation is only available to the user who created the annotation.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

Parameters used to make a successful request.

Body

{
  "type": "string",
  "text": "string",
  "classification": "string",
  "ownership": {
    "type": "WS",
    "identifier": "string"
  },
  "referencing_date": "string",
  "reference_period": "string",
  "reference_type": "string",
  "reference_ids": [
    "string"
  ],
  "item_classifier": "string"
}

Each of the fields are optional; only the field included in the request will be updated on the database.

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "id": "string"
}
On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are:

API

Update references

This API is responsible for updating an annotation`s references.

[PUT]/api/v1/annotations/{id}/{operation}

Response: The id of the updated annotation.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

Parameters used to make a successful request.

Body

{
  "reference_ids": [
    "string"
  ]
}

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "id": "string"
}
On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are:

API

Delete annotation

This API is responsible for soft deleting an annotation.

[DELETE]/api/v1/annotations/{id}

Response: The id of the deleted annotation.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

Parameters used to make a successful request.

Body

No body is needed to make this request.

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "id": "string"
}
On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are:

API

Search annotations

This API is responsible for searching annotations.

[POST]/api/v1/annotations/search

Response: A list of the requested annotations.

Header

Header used on this API are those taken from header standards of TS Digital.

Content-type is accepted in application/json

Query Parameters

No query parameters are needed to make this request.

Body

{
  "limit": "integer",
  "from": "integer",
  "ownership": {
    "type": "WS",
    "identifier": "string"
  },
  "sort": {
    "name": "CREATED",
    "order": "ASC"
  },
  "type": "string",
  "reference_ids": [
    "string"
  ],
  "show_deleted": true,
  "search_words": "string"
}

Response

On successful response

If successful, the API responds with HTTP code 200(OK) with the following body:

{
  "count": "integer",
  "data": [
    {
      "id": "string",
      "type": "string",
      "text": "string",
      "classification": "string",
      "referencingDate": "string",
      "referencePeriod": "string",
      "referenceType": "string",
      "referenceIds": [
        "string"
      ],
      "deleted": true,
      "ownership": {
        "type": "WS",
        "identifier": "string"
      },
      "itemClassifier": "string",
      "insertedBy": "string",
      "insertedAt": "2022-10-31T15:02:44.115Z",
      "modifiedAt": "2022-10-31T15:02:44.115Z"
    }
  ]
}

The elements inside the data list contain the following fields:

On error response

In the event of an error, the API responds with a body JSON with the following format:

{
  "code": "string",
  "timestamp": "2022-10-28T13:01:00.754Z",
  "message": "string",
  "subErrors": [
    {}
  ]
}

Possible errors are: