Cerrar sesión
curl --request POST \
--url https://docs.pymo.uy/v1/logout \
--cookie connect.sid=import requests
url = "https://docs.pymo.uy/v1/logout"
headers = {"cookie": "connect.sid="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: 'connect.sid='}};
fetch('https://docs.pymo.uy/v1/logout', 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://docs.pymo.uy/v1/logout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "connect.sid=",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://docs.pymo.uy/v1/logout"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "connect.sid=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://docs.pymo.uy/v1/logout")
.header("cookie", "connect.sid=")
.asString();require 'uri'
require 'net/http'
url = URI("https://docs.pymo.uy/v1/logout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'connect.sid='
response = http.request(request)
puts response.read_body{
"payload": {},
"message": {
"code": "LOGGED_OUT",
"value": "Sessión cerrada correctamente"
},
"status": "SUCCESS"
}{
"payload": {},
"message": {
"code": "UNAUTHORIZED",
"value": "Debe iniciar sesión."
},
"status": "FAIL"
}{
"payload": {},
"message": {
"code": "FORBIDDEN",
"value": "No tiene permisos para realizar esta acción."
},
"status": "FAIL"
}1 Autenticación
Cerrar sesión
Cierra la sesión.
Acceso: restringida. Requiere sesión.
POST
/
v1
/
logout
Cerrar sesión
curl --request POST \
--url https://docs.pymo.uy/v1/logout \
--cookie connect.sid=import requests
url = "https://docs.pymo.uy/v1/logout"
headers = {"cookie": "connect.sid="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: 'connect.sid='}};
fetch('https://docs.pymo.uy/v1/logout', 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://docs.pymo.uy/v1/logout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "connect.sid=",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://docs.pymo.uy/v1/logout"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "connect.sid=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://docs.pymo.uy/v1/logout")
.header("cookie", "connect.sid=")
.asString();require 'uri'
require 'net/http'
url = URI("https://docs.pymo.uy/v1/logout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'connect.sid='
response = http.request(request)
puts response.read_body{
"payload": {},
"message": {
"code": "LOGGED_OUT",
"value": "Sessión cerrada correctamente"
},
"status": "SUCCESS"
}{
"payload": {},
"message": {
"code": "UNAUTHORIZED",
"value": "Debe iniciar sesión."
},
"status": "FAIL"
}{
"payload": {},
"message": {
"code": "FORBIDDEN",
"value": "No tiene permisos para realizar esta acción."
},
"status": "FAIL"
}Autorizaciones
Sesión por cookie de POST /v1/login, válida 1 hora. Ver Autenticación.
Respuesta
Éxito
Envoltorio común a todas las respuestas. status no se deduce del código HTTP: hay al menos nueve lugares en el gateway que responden HTTP 200 con status: "FAIL" (por ejemplo CFE_NOT_FOUND y DGI_COMPANY_NOT_READY_YET). Un cliente tiene que leer status, no el código.
Los datos de la respuesta. {} cuando el endpoint no devuelve nada.
De las 82 claves de mensaje del gateway, 29 son SUCCESS y 53 FAIL. Es lo que hay que mirar para saber si la llamada funcionó.
Opciones disponibles:
SUCCESS, FAIL Presente cuando la operación tiene algo que decir. Las lecturas simples responden sólo payload y status.
Show child attributes
Show child attributes