Crear una tarea propia
curl --request POST \
--url https://api.ugps.io/api/maintenance/task-definitions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "PUR",
"name": "Purga del filtro separador",
"description": "<string>"
}
'import requests
url = "https://api.ugps.io/api/maintenance/task-definitions"
payload = {
"code": "PUR",
"name": "Purga del filtro separador",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: 'PUR', name: 'Purga del filtro separador', description: '<string>'})
};
fetch('https://api.ugps.io/api/maintenance/task-definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ugps.io/api/maintenance/task-definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'PUR',
'name' => 'Purga del filtro separador',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/maintenance/task-definitions"
payload := strings.NewReader("{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ugps.io/api/maintenance/task-definitions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/maintenance/task-definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"id": "507f1f77bcf86cd799439011",
"code": "ACM",
"name": "Cambio de aceite de motor",
"category": "Mantencion preventiva",
"description": "<string>",
"origin": "base",
"baseKey": "engine_oil_change",
"status": "active",
"archivedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"usedInPrograms": [
{
"id": "<string>",
"name": "<string>",
"conditions": {
"odometer": {
"everyKm": 40000,
"remindBeforeKm": 4000
},
"engineHours": {
"everyHours": 2,
"remindBeforeHours": 1
},
"date": {
"every": 2,
"unit": "days",
"remindBefore": 1,
"remindUnit": "days"
}
}
}
]
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "No tiene permisos para realizar esta acción"
}{
"message": "Error interno del servidor"
}Mantenimiento - Tareas
Crear una tarea propia
Responde 400 MAINTENANCE_TASK_DEFINITION_CODE_TAKEN si el código ya existe (también en una archivada) y MAINTENANCE_TASK_DEFINITION_NAME_TAKEN si una tarea activa ya usa el nombre, sin distinguir tildes ni mayúsculas. El mensaje nombra la tarea que choca.
POST
/
api
/
maintenance
/
task-definitions
Crear una tarea propia
curl --request POST \
--url https://api.ugps.io/api/maintenance/task-definitions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "PUR",
"name": "Purga del filtro separador",
"description": "<string>"
}
'import requests
url = "https://api.ugps.io/api/maintenance/task-definitions"
payload = {
"code": "PUR",
"name": "Purga del filtro separador",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: 'PUR', name: 'Purga del filtro separador', description: '<string>'})
};
fetch('https://api.ugps.io/api/maintenance/task-definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ugps.io/api/maintenance/task-definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => 'PUR',
'name' => 'Purga del filtro separador',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ugps.io/api/maintenance/task-definitions"
payload := strings.NewReader("{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ugps.io/api/maintenance/task-definitions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/maintenance/task-definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"PUR\",\n \"name\": \"Purga del filtro separador\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"id": "507f1f77bcf86cd799439011",
"code": "ACM",
"name": "Cambio de aceite de motor",
"category": "Mantencion preventiva",
"description": "<string>",
"origin": "base",
"baseKey": "engine_oil_change",
"status": "active",
"archivedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"usedInPrograms": [
{
"id": "<string>",
"name": "<string>",
"conditions": {
"odometer": {
"everyKm": 40000,
"remindBeforeKm": 4000
},
"engineHours": {
"everyHours": 2,
"remindBeforeHours": 1
},
"date": {
"every": 2,
"unit": "days",
"remindBefore": 1,
"remindUnit": "days"
}
}
}
]
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"error": "No tiene permisos para realizar esta acción"
}{
"message": "Error interno del servidor"
}Authorizations
Token de sesión Better Auth o API token (atk_...) en el header Authorization: Bearer <token>. Los JWT legacy ya no son válidos.
Body
application/json
De 2 a 8 letras o dígitos, empezando con una letra; se guarda en mayúsculas.
Example:
"PUR"
Maximum string length:
120Example:
"Purga del filtro separador"
Categoría de la tarea, de la lista compartida de categorías de tarea de servicio. Los valores van sin tildes; la web muestra su etiqueta.
Available options:
Mantencion preventiva, Motor, Frenos, Neumaticos, Sistema electrico, Suspension y direccion, Transmision, Carroceria, Otros Maximum string length:
1000
