Tags
Gerenciamento de tags para organização de versões no Decision Engine.
Endpoints
| Método | Endpoint | Descrição | Permissão |
|---|---|---|---|
| POST | /api/v1/tags | Criar tag | DECISION_TAGS_MANAGE |
| GET | /api/v1/tags | Listar tags | DECISION_TAGS_MANAGE |
| GET | /api/v1/tags/:id | Obter tag | DECISION_TAGS_MANAGE |
| PATCH | /api/v1/tags/:id | Atualizar tag | DECISION_TAGS_MANAGE |
| DELETE | /api/v1/tags/:id | Excluir tag | DECISION_TAGS_MANAGE |
Criar Tag
POST /api/v1/tags
Cria uma nova tag para organizar decisões.
Request
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Sim | Nome da tag (1-100 chars) |
color | string | Sim | Cor em hexadecimal (#RRGGBB) |
- cURL
- JavaScript
curl -X POST 'https://decision-engine.stg.catalisa.app/api/v1/tags' \
-H 'Authorization: Bearer SEU_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Producao",
"color": "#22C55E"
}'
const response = await fetch('https://decision-engine.stg.catalisa.app/api/v1/tags', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Producao',
color: '#22C55E',
}),
});
const tag = await response.json();
Response (201 Created)
{
"data": {
"type": "tags",
"id": "880e8400-e29b-41d4-a716-446655440003",
"attributes": {
"name": "Producao",
"color": "#22C55E",
"createdAt": "2024-01-15T10:30:00Z"
},
"links": {
"self": "/api/v1/tags/880e8400-e29b-41d4-a716-446655440003"
}
}
}
Listar Tags
GET /api/v1/tags
Lista todas as tags da organização.
Query Parameters
| Parâmetro | Tipo | Descrição |
|---|---|---|
page[number] | integer | Número da página |
page[size] | integer | Itens por página |
- cURL
- JavaScript
curl 'https://decision-engine.stg.catalisa.app/api/v1/tags' \
-H 'Authorization: Bearer SEU_TOKEN'
const response = await fetch('https://decision-engine.stg.catalisa.app/api/v1/tags', {
headers: {
'Authorization': `Bearer ${token}`,
},
});
const { data, meta } = await response.json();
Response (200 OK)
{
"data": [
{
"type": "tags",
"id": "880e8400-e29b-41d4-a716-446655440003",
"attributes": {
"name": "Producao",
"color": "#22C55E"
}
},
{
"type": "tags",
"id": "880e8400-e29b-41d4-a716-446655440004",
"attributes": {
"name": "Homologação",
"color": "#EAB308"
}
},
{
"type": "tags",
"id": "880e8400-e29b-41d4-a716-446655440005",
"attributes": {
"name": "Desenvolvimento",
"color": "#3B82F6"
}
}
],
"meta": {
"totalItems": 3,
"totalPages": 1,
"currentPage": 1
}
}
Obter Tag
GET /api/v1/tags/:tagId
Obtém detalhes de uma tag específica.
- cURL
- JavaScript
curl 'https://decision-engine.stg.catalisa.app/api/v1/tags/880e8400-e29b-41d4-a716-446655440003' \
-H 'Authorization: Bearer SEU_TOKEN'
const tagId = '880e8400-e29b-41d4-a716-446655440003';
const response = await fetch(
`https://decision-engine.stg.catalisa.app/api/v1/tags/${tagId}`,
{
headers: {
'Authorization': `Bearer ${token}`,
},
}
);
const tag = await response.json();
Atualizar Tag
PATCH /api/v1/tags/:tagId
Atualiza uma tag existente.
Request
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Não | Novo nome |
color | string | Não | Nova cor |
- cURL
- JavaScript
curl -X PATCH 'https://decision-engine.stg.catalisa.app/api/v1/tags/880e8400-e29b-41d4-a716-446655440003' \
-H 'Authorization: Bearer SEU_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Producao v2",
"color": "#16A34A"
}'
const tagId = '880e8400-e29b-41d4-a716-446655440003';
const response = await fetch(
`https://decision-engine.stg.catalisa.app/api/v1/tags/${tagId}`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Producao v2',
color: '#16A34A',
}),
}
);
const tag = await response.json();
Excluir Tag
DELETE /api/v1/tags/:tagId
Remove uma tag do sistema.
- cURL
- JavaScript
curl -X DELETE 'https://decision-engine.stg.catalisa.app/api/v1/tags/880e8400-e29b-41d4-a716-446655440003' \
-H 'Authorization: Bearer SEU_TOKEN'
const tagId = '880e8400-e29b-41d4-a716-446655440003';
const response = await fetch(
`https://decision-engine.stg.catalisa.app/api/v1/tags/${tagId}`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`,
},
}
);
// Status 204 No Content = sucesso
Response (204 No Content)
Sem corpo de resposta.
Usando Tags em Decisoes
Ao criar ou atualizar uma decisão, você pode associar tags:
// Criar decisão com tags
const response = await fetch('https://decision-engine.stg.catalisa.app/api/v1/decisions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
projectId: 'project-uuid',
name: 'Score Check',
key: 'score-check',
tagIds: ['tag-uuid-1', 'tag-uuid-2'],
}),
});
Erros Comuns
| Código | Erro | Descrição |
|---|---|---|
| 400 | VALIDATION | Nome vazio ou cor invalida |
| 404 | NOT_FOUND | Tag não encontrada |
| 409 | CONFLICT | Nome de tag duplicado |