Skip to main content

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.

  • id: Unique identifier associated with the requested annotation. (required)
  • operation: it can be ATTACH in case there need to be added references and DETACH in case the references need to be removed. (required)

Body

{
  "reference_ids": [
    "string"
  ]
}
  • reference_ids: the ids of the related documents to be added or removed

Response

On successful response

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

{
  "id": "string"
}
  • id: the unique identifier of the annotation
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": [
    {}
  ]
}
  • code: A string representation of the HTTP error code, linked with the returned http error
  • timestamp: Date and time of the answer, expressed as a string.
  • message: Message expressing error.

Possible errors are:

  • 400: The request is malformed (parameters with incorrect format, invalid or inconsistent parameters).
  • 401: An authorization token has not been provided or the authorization token provided is invalid (eg: it has expired).
  • 403: The provided token is valid, but the user is not authorized to perform the operation.
  • 404: No annotation found with the given id.
  • 500: An unexpected error occurred.