Skip to main content

Create Tag For App

Este endpoint sirve para definir tags en una aplicación específica, elegida por la variable de ruta application_id. Estas definiciones son necesarias para el uso del servicio tags en personas, dado que para asignar un valor a un tag, primero se revisa que la definición de ese tag se encuentre en la aplicación. Cuando se entrega la respuesta, se muestran todas las definiciones de tags presentes en la aplicación.

Endpoint#

Headers

KeyValueDescription
Content-Typeapplication/json
AuthorizationBearer {{access_token}}access_token obtained in Atenea
Method: POST
URL: https://api.trust.lat/index/v1/app/:application_id/tags

Path Variables:

KeyValue ExampleDescription
application_id99Identificador de aplicación provisto por empresa Trust. Obligatorio.
caution

Recuerda que para utilizar este endpoint es necesario un access token obtenido en el servicio Atenea

Como obtener un access token

Body#

Fields#

  • tag_name: Campo que indica el nombre con el cual se identifica el tag. Obligatorio.
  • description: Texto que permite detallar el próposito y/o uso del tag. Obligatorio.
  • color: Código RGB hexadecimal utilizado para identificar el tag en un entorno web. Obligatorio.

Example#

{
"tag_name": "workspace",
"description": "Enviroment where the person do his job",
"color": "#FF0000"
}

Code Examples#

curl --location --request POST 'https://api.trust.lat/index/v1/app/99/tags' \
--header 'Authorization: Bearer ************' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag_name": "workspace",
"description": "Enviroment where the person do his job",
"color": "#FF0000"
}'

Responses#

HTTP Code: 201 Created#

Created new tag for app#

{
"code": 201,
"resource": "AppTags",
"data": {
"application_id": "99",
"company_uid": "99",
"created_at": "2021-07-09T17:41:05.318Z",
"tags": [
{
"color": "#00FF00",
"deleted_at": null,
"description": "Timelapse when the worker do his job",
"name": "workshift",
"updated_at": "2021-07-12T16:22:18.389Z",
"values": []
}
],
"updated_at": "2021-07-09T17:41:05.318Z"
},
"message": "Created"
}

Created new tag for app with others tag present#

{
"code": 201,
"resource": "AppTags",
"data": {
"application_id": "99",
"company_uid": "99",
"created_at": "2021-07-09T17:41:05.318Z",
"tags": [
{
"color": "#00FF00",
"deleted_at": null,
"description": "Timelapse when the worker do his job",
"name": "workshift",
"updated_at": "2021-07-12T16:22:18.389Z",
"values": []
},
{
"color": "#FF0000",
"deleted_at": null,
"description": "Enviroment where the person do his job",
"name": "workspace",
"updated_at": "2021-07-12T16:23:04.469Z",
"values": []
}
],
"updated_at": "2021-07-09T17:41:05.318Z"
},
"message": "Created"
}

HTTP Code: 422 Unprocessable Entity#

Application_id not present in Trust Services#

{
"code": 422,
"resource": "AppTags",
"message": "Fail",
"errors": {
"company_uid": [
"can't be blank"
]
}
}

Missing tags fields#

{
"code": 422,
"resource": "AppTags",
"message": "Fail",
"errors": {
"tags": [
"is invalid"
]
}
}

Tag for app already exists#

{
"code": 422,
"resource": "AppTags",
"message": "Fail",
"errors": {
"tags": [
"duplicated tag name"
]
}
}
Last updated on by Claudio-Franco