Actualizar estado de múltiples notificaciones
curl --request PATCH \
--url https://api.ugps.io/api/notifications/status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"507f1f77bcf86cd799439011",
"507f1f77bcf86cd799439012"
]
}
'import requests
url = "https://api.ugps.io/api/notifications/status"
payload = { "ids": ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['507f1f77bcf86cd799439011', '507f1f77bcf86cd799439012']})
};
fetch('https://api.ugps.io/api/notifications/status', 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/notifications/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'507f1f77bcf86cd799439011',
'507f1f77bcf86cd799439012'
]
]),
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/notifications/status"
payload := strings.NewReader("{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.ugps.io/api/notifications/status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/notifications/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"message": "Estados de notificaciones actualizados correctamente",
"modifiedCount": 5
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"message": "Error interno del servidor"
}Alertas - Notificaciones
Actualizar estado de múltiples notificaciones
Actualiza el estado de múltiples notificaciones en una sola operación. Solo se actualizan las notificaciones que pertenecen al cliente autenticado. Si algunos IDs no existen o no pertenecen al cliente, simplemente no se actualizan (reflejado en modifiedCount).
PATCH
/
api
/
notifications
/
status
Actualizar estado de múltiples notificaciones
curl --request PATCH \
--url https://api.ugps.io/api/notifications/status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"507f1f77bcf86cd799439011",
"507f1f77bcf86cd799439012"
]
}
'import requests
url = "https://api.ugps.io/api/notifications/status"
payload = { "ids": ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['507f1f77bcf86cd799439011', '507f1f77bcf86cd799439012']})
};
fetch('https://api.ugps.io/api/notifications/status', 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/notifications/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'507f1f77bcf86cd799439011',
'507f1f77bcf86cd799439012'
]
]),
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/notifications/status"
payload := strings.NewReader("{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.ugps.io/api/notifications/status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ugps.io/api/notifications/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"507f1f77bcf86cd799439011\",\n \"507f1f77bcf86cd799439012\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"message": "Estados de notificaciones actualizados correctamente",
"modifiedCount": 5
}
}{
"error": "El email es requerido"
}{
"error": "Token inválido o expirado"
}{
"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
Lista de IDs de notificaciones (ObjectId de 24 caracteres hexadecimales)
Minimum array length:
1Pattern:
^[a-fA-F0-9]{24}$Example:
[
"507f1f77bcf86cd799439011",
"507f1f77bcf86cd799439012"
]
Nuevo estado para las notificaciones
Available options:
unreviewed, reviewed, false_positive ⌘I