Skip to content

Additional Fields endpoint

Kirill Ponomarev edited this page Feb 24, 2023 · 3 revisions

General info about the endpoint

The Additional Fields endpoint enables users to manage their Additional fields. Additional fields are linked to records, they can't exist independently. Users can perform the following operations:

HTTP Method Description
POST Create a new additional field
PUT Edit an existing additional field
DELETE Delete an additional field
GET Get all additional fields for the specific record

Authentication

This endpoint requires authentication, token recieved after login procedure included in x-access-token header.

Request/Response

The API accepts and returns JSON. The request and response for each operation is described below.

Create a new additional field

POST /additional_fields

Request (JSON Body)

Parameter Type Required Nullable Encrypted Description
id string Yes No No The ID of the new additional field
name string Yes No Yes The name associated with the new additional field
value string Yes No Yes The value (content) for the new additional field
record_id string Yes No No The record id associated with the new additional field

Response

HTTP Status Code Response Body
201 {
"message": { "success": "Additional field <additional_field_id> created" } }
404 { "message": { "error": "Resource Not Found. Record with id <record_id> doesn't exist" } }
403 { "message": { "error": "Access Denied. Record <record_id> doesn't belong to the current user <user_id>" } }
409 { "message": { "error": "Resource Already Exists. Additional field with id <additional_field_id> already exists" } }
400 { "message": { "name": "This JSON body argument is missing at all or it's value is null" } }
400 {"message": { "value": "This JSON body argument is in wrong format. Correct format is IV:Data", "name": "This JSON body argument is an empty string"} }

Edit an existing additional field

PUT /additional_fields

Request (JSON Body)

Parameter Type Required Nullable Encrypted Description
id string Yes No No The ID of the existing additional field
name string Yes No Yes The name associated with the existing additional field
value string Yes No Yes The value (content) for the existing additional field
record_id string Yes No No The record id associated with the existing additional field

Response

HTTP Status Code Response Body
200 {
"message": { "success": "Additional field <additional_field_id> changed successfully" } }
404 { "message": { "error": "Resource Not Found. Additional field with id <additional_field_id> doesn't exist" } }
403 { "message": { "error": "Access Denied. Additional field <additional_field_id> doesn't belong to the current user <user_id>" } }
400 { "message": { "name": "This JSON body argument is missing at all or it's value is null" } }
400 {"message": { "login": "This JSON body argument is in wrong format. Correct format is IV:Data", "name": "This JSON body argument is an empty string"} }

Delete an additional field

DELETE /additional_fields?id=example_id

Request (Query Parameters)

Field Type Required Encrypted Description
id string Yes No The unique identifier for the additional field

Response

HTTP Status Code Response Body
200 {
"message": { "success": "Additional field <additional_field_id> deleted successfully" } }
400 { "message": { "error": "Missing Parameter. Additional field id is missing in URI arguments" } }
404 { "message": { "error": "Resource Not Found. Additional field with id <additional_field_id> doesn't exist" } }
403 { "message": { "error": "Access Denied. Additional field <additional_field_id> doesn't belong to the current user <user_id>" } }

Get all additional fields for the specific record

GET additional_fields?id=example_record_id

Request (Query Parameters)

Field Type Required Encrypted Description
id string Yes No The unique identifier for the record of an additional field

Successful response

[ {  "id": "example_id",  "name": "example_name",  "value": "example_value",  "record_id": "example_record_id" }, {  "id": "example_id_2",  "name": "example_name_2",  "value": "example_value_2",  "record_id": "example_record_id" } ]

Error response

HTTP Status Code Response Body
400 { "message": { "error": "Missing Parameter. Record id is missing in URI arguments" } }
404 { "message": { "error": "Resource Not Found. Record with id <record_id> doesn't exist" } }
403 { "message": { "error": "Access Denied. Record <record_id> doesn't belong to the current user <user_id>" } }
404 { "message": { "error": "Resource Not Found. Current user's <user_id> record <record_id> has no additional fields" } }