MENU navbar-image

Introduction

API REST para aplicación móvil con sincronización offline/online, autenticación Sanctum y gestión de usuarios.

Esta API está diseñada para aplicaciones móviles que requieren funcionalidad offline/online con sincronización automática.

<aside>
<strong>Características principales:</strong>
<ul>
    <li>Autenticación con Laravel Sanctum (Bearer tokens)</li>
    <li>Sincronización bidireccional de datos</li>
    <li>Gestión completa de usuarios y sesiones</li>
    <li>Soporte para modo offline</li>
    <li>Resolución de conflictos de datos</li>
</ul>
</aside>

Puedes probar los endpoints directamente desde esta documentación. Para endpoints protegidos, primero haz login en `/api/auth/login` y usa el token recibido.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer Bearer {your-token-here}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Para obtener un token, haz POST a /api/auth/login con tus credenciales. El token tiene una duración de 24 horas.

Autenticación

APIs para registro, login y gestión de autenticación de usuarios

Registrar nuevo usuario

Crea una nueva cuenta de usuario con autenticación Sanctum.

Example request:
curl --request POST \
    "http://localhost/api/auth/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"name\": \"Juan Pérez\",
    \"email\": \"juan@example.com\",
    \"password\": \"Password123!\",
    \"password_confirmation\": \"consequatur\",
    \"phone_number\": \"+52 555 123 4567\",
    \"device_id\": \"abc123def456\",
    \"device_name\": \"Samsung Galaxy S21\",
    \"device_type\": \"android\",
    \"app_version\": \"1.0.0\",
    \"is_offline_capable\": true,
    \"preferences\": {
        \"theme\": \"dark\",
        \"language\": \"bzvrb\",
        \"notifications\": true,
        \"auto_sync\": true,
        \"sync_frequency\": \"realtime\"
    },
    \"accept_terms\": true,
    \"accept_privacy\": true,
    \"timezone\": \"America\\/Punta_Arenas\",
    \"referral_code\": \"znkygloigmkwxphlv\"
}"
const url = new URL(
    "http://localhost/api/auth/register"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "name": "Juan Pérez",
    "email": "juan@example.com",
    "password": "Password123!",
    "password_confirmation": "consequatur",
    "phone_number": "+52 555 123 4567",
    "device_id": "abc123def456",
    "device_name": "Samsung Galaxy S21",
    "device_type": "android",
    "app_version": "1.0.0",
    "is_offline_capable": true,
    "preferences": {
        "theme": "dark",
        "language": "bzvrb",
        "notifications": true,
        "auto_sync": true,
        "sync_frequency": "realtime"
    },
    "accept_terms": true,
    "accept_privacy": true,
    "timezone": "America\/Punta_Arenas",
    "referral_code": "znkygloigmkwxphlv"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/register';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'name' => 'Juan Pérez',
            'email' => 'juan@example.com',
            'password' => 'Password123!',
            'password_confirmation' => 'consequatur',
            'phone_number' => '+52 555 123 4567',
            'device_id' => 'abc123def456',
            'device_name' => 'Samsung Galaxy S21',
            'device_type' => 'android',
            'app_version' => '1.0.0',
            'is_offline_capable' => true,
            'preferences' => [
                'theme' => 'dark',
                'language' => 'bzvrb',
                'notifications' => true,
                'auto_sync' => true,
                'sync_frequency' => 'realtime',
            ],
            'accept_terms' => true,
            'accept_privacy' => true,
            'timezone' => 'America/Punta_Arenas',
            'referral_code' => 'znkygloigmkwxphlv',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):


{
    "success": true,
    "message": "Usuario registrado exitosamente",
    "data": {
        "user": {
            "id": 1,
            "name": "Juan Pérez",
            "email": "juan@example.com",
            "status": "active"
        },
        "token": "1|abcdefghijklmnop",
        "offline_token": "xyz789",
        "session_id": 1,
        "expires_at": "2024-02-15T10:00:00.000000Z"
    }
}
 

Request      

POST api/auth/register

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

name   string   

Nombre completo del usuario. Example: Juan Pérez

email   string   

Email del usuario. Example: juan@example.com

password   string   

Contraseña (mínimo 8 caracteres). Example: Password123!

password_confirmation   string   

The value and password must match. Example: consequatur

phone_number   string  optional  

Número de teléfono. Example: +52 555 123 4567

device_id   string  optional  

ID del dispositivo. Example: abc123def456

device_name   string  optional  

Nombre del dispositivo. Example: Samsung Galaxy S21

device_type   string  optional  

Tipo de dispositivo. Example: android

app_version   string  optional  

Versión de la app. Example: 1.0.0

is_offline_capable   boolean  optional  

Soporte offline. Example: true

preferences   object  optional  
theme   string  optional  

Example: dark

Must be one of:
  • light
  • dark
  • auto
language   string  optional  

Must not be greater than 5 characters. Example: bzvrb

notifications   boolean  optional  

Example: true

auto_sync   boolean  optional  

Example: true

sync_frequency   string  optional  

Example: realtime

Must be one of:
  • realtime
  • hourly
  • daily
  • manual
accept_terms   boolean   

Must be accepted. Example: true

accept_privacy   boolean   

Must be accepted. Example: true

timezone   string  optional  

Must not be greater than 50 characters. Example: America/Punta_Arenas

referral_code   string  optional  

Must not be greater than 20 characters. Example: znkygloigmkwxphlv

Iniciar sesión

Autentica un usuario y retorna un token de acceso.

Example request:
curl --request POST \
    "http://localhost/api/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"email\": \"juan@example.com\",
    \"password\": \"Password123!\",
    \"device_id\": \"abc123def456\",
    \"device_name\": \"Samsung Galaxy S21\",
    \"device_type\": \"android\",
    \"app_version\": \"1.0.0\",
    \"revoke_other_tokens\": false,
    \"is_offline_capable\": false,
    \"remember_me\": true,
    \"timezone\": \"Europe\\/Moscow\",
    \"language\": \"rbyic\"
}"
const url = new URL(
    "http://localhost/api/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "email": "juan@example.com",
    "password": "Password123!",
    "device_id": "abc123def456",
    "device_name": "Samsung Galaxy S21",
    "device_type": "android",
    "app_version": "1.0.0",
    "revoke_other_tokens": false,
    "is_offline_capable": false,
    "remember_me": true,
    "timezone": "Europe\/Moscow",
    "language": "rbyic"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/login';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'email' => 'juan@example.com',
            'password' => 'Password123!',
            'device_id' => 'abc123def456',
            'device_name' => 'Samsung Galaxy S21',
            'device_type' => 'android',
            'app_version' => '1.0.0',
            'revoke_other_tokens' => false,
            'is_offline_capable' => false,
            'remember_me' => true,
            'timezone' => 'Europe/Moscow',
            'language' => 'rbyic',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "message": "Inicio de sesión exitoso",
    "data": {
        "user": {
            "id": 1,
            "name": "Juan Pérez",
            "email": "juan@example.com"
        },
        "token": "1|abcdefghijklmnop",
        "offline_token": "xyz789",
        "session_id": 1,
        "expires_at": "2024-02-15T10:00:00.000000Z"
    }
}
 

Example response (422):


{
    "success": false,
    "message": "Credenciales incorrectas"
}
 

Request      

POST api/auth/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

email   string   

Email del usuario. Example: juan@example.com

password   string   

Contraseña. Example: Password123!

device_id   string  optional  

ID del dispositivo. Example: abc123def456

device_name   string  optional  

Nombre del dispositivo. Example: Samsung Galaxy S21

device_type   string  optional  

Tipo de dispositivo. Example: android

app_version   string  optional  

Versión de la app. Example: 1.0.0

revoke_other_tokens   boolean  optional  

Revocar otros tokens activos. Example: false

is_offline_capable   boolean  optional  

Example: false

remember_me   boolean  optional  

Example: true

timezone   string  optional  

Must not be greater than 50 characters. Example: Europe/Moscow

language   string  optional  

Must not be greater than 5 characters. Example: rbyic

Solicitar recuperación de contraseña POST /api/auth/forgot-password

Example request:
curl --request POST \
    "http://localhost/api/auth/forgot-password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"email\": \"qkunze@example.com\",
    \"device_id\": \"opfuudtdsufvyvddqamni\",
    \"device_type\": \"android\",
    \"app_version\": \"hfqcoynlazghdtqtq\",
    \"language\": \"xbajw\",
    \"timezone\": \"Africa\\/Kampala\"
}"
const url = new URL(
    "http://localhost/api/auth/forgot-password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "email": "qkunze@example.com",
    "device_id": "opfuudtdsufvyvddqamni",
    "device_type": "android",
    "app_version": "hfqcoynlazghdtqtq",
    "language": "xbajw",
    "timezone": "Africa\/Kampala"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/forgot-password';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'email' => 'qkunze@example.com',
            'device_id' => 'opfuudtdsufvyvddqamni',
            'device_type' => 'android',
            'app_version' => 'hfqcoynlazghdtqtq',
            'language' => 'xbajw',
            'timezone' => 'Africa/Kampala',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/auth/forgot-password

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

email   string   

Must be a valid email address. The email of an existing record in the users table. Must not be greater than 255 characters. Example: qkunze@example.com

device_id   string  optional  

Must not be greater than 100 characters. Example: opfuudtdsufvyvddqamni

device_type   string  optional  

Example: android

Must be one of:
  • android
  • ios
  • web
app_version   string  optional  

Must not be greater than 20 characters. Example: hfqcoynlazghdtqtq

language   string  optional  

Must not be greater than 5 characters. Example: xbajw

timezone   string  optional  

Must not be greater than 50 characters. Example: Africa/Kampala

Resetear contraseña con token POST /api/auth/reset-password

Example request:
curl --request POST \
    "http://localhost/api/auth/reset-password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"email\": \"qkunze@example.com\",
    \"token\": \"consequatur\",
    \"password\": \"[2UZ5ij-e\\/dl4\"
}"
const url = new URL(
    "http://localhost/api/auth/reset-password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "email": "qkunze@example.com",
    "token": "consequatur",
    "password": "[2UZ5ij-e\/dl4"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/reset-password';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'email' => 'qkunze@example.com',
            'token' => 'consequatur',
            'password' => '[2UZ5ij-e/dl4',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/auth/reset-password

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

email   string   

Must be a valid email address. Example: qkunze@example.com

token   string   

Example: consequatur

password   string   

Must be at least 8 characters. Example: [2UZ5ij-e/dl4

Verificar email del usuario GET /api/auth/verify-email/{token}

Example request:
curl --request GET \
    --get "http://localhost/api/auth/verify-email/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/verify-email/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/verify-email/consequatur';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (500):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Server Error"
}
 

Request      

GET api/auth/verify-email/{token}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

token   string   

Example: consequatur

Obtener perfil del usuario autenticado GET /api/auth/profile

Example request:
curl --request GET \
    --get "http://localhost/api/auth/profile" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/profile"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/profile';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/auth/profile

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Cerrar sesión

requires authentication

Cierra la sesión actual y revoca el token de acceso.

Example request:
curl --request POST \
    "http://localhost/api/auth/logout" \
    --header "Authorization: Bearer Bearer {your-token-here}" \
    --header "X-Session-ID: string ID de la sesión activa. Example: 123" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/logout"
);

const headers = {
    "Authorization": "Bearer Bearer {your-token-here}",
    "X-Session-ID": "string ID de la sesión activa. Example: 123",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/logout';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer Bearer {your-token-here}',
            'X-Session-ID' => 'string ID de la sesión activa. Example: 123',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "message": "Sesión cerrada exitosamente"
}
 

Request      

POST api/auth/logout

Headers

Authorization      

Example: Bearer Bearer {your-token-here}

X-Session-ID      

Example: string ID de la sesión activa. Example: 123

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Cerrar todas las sesiones del usuario POST /api/auth/logout-all

Example request:
curl --request POST \
    "http://localhost/api/auth/logout-all" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/logout-all"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/logout-all';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/auth/logout-all

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Renovar token de autenticación POST /api/auth/refresh

Example request:
curl --request POST \
    "http://localhost/api/auth/refresh" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/refresh"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/refresh';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/auth/refresh

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Validar y verificar estado del token GET /api/auth/validate-token POST /api/auth/validate-token

Example request:
curl --request GET \
    --get "http://localhost/api/auth/validate-token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/validate-token"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/validate-token';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/auth/validate-token

POST api/auth/validate-token

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

DEPRECATED: Usar validateToken en su lugar GET /api/auth/check-token

Example request:
curl --request GET \
    --get "http://localhost/api/auth/check-token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/auth/check-token"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/auth/check-token';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/auth/check-token

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Usuarios

APIs para gestión de usuarios y perfiles

Listar usuarios

requires authentication

Obtiene la lista de usuarios (solo administradores).

Example request:
curl --request GET \
    --get "http://localhost/api/users?page=1&per_page=15&search=juan&status=active&role=user&sort_by=created_at&sort_order=desc" \
    --header "Authorization: Bearer Bearer {your-token-here}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"page\": 73,
    \"per_page\": 13,
    \"search\": \"qeopfuudtdsufvyvddqam\",
    \"status\": \"suspended\",
    \"role\": \"user\",
    \"sort_by\": \"name\",
    \"sort_order\": \"desc\"
}"
const url = new URL(
    "http://localhost/api/users"
);

const params = {
    "page": "1",
    "per_page": "15",
    "search": "juan",
    "status": "active",
    "role": "user",
    "sort_by": "created_at",
    "sort_order": "desc",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {your-token-here}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "page": 73,
    "per_page": 13,
    "search": "qeopfuudtdsufvyvddqam",
    "status": "suspended",
    "role": "user",
    "sort_by": "name",
    "sort_order": "desc"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer Bearer {your-token-here}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'query' => [
            'page' => '1',
            'per_page' => '15',
            'search' => 'juan',
            'status' => 'active',
            'role' => 'user',
            'sort_by' => 'created_at',
            'sort_order' => 'desc',
        ],
        'json' => [
            'page' => 73,
            'per_page' => 13,
            'search' => 'qeopfuudtdsufvyvddqam',
            'status' => 'suspended',
            'role' => 'user',
            'sort_by' => 'name',
            'sort_order' => 'desc',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "Juan Pérez",
                "email": "juan@example.com",
                "status": "active",
                "role": "user"
            }
        ],
        "total": 50
    }
}
 

Example response (403):


{
    "success": false,
    "message": "Sin permisos para ver usuarios"
}
 

Request      

GET api/users

Headers

Authorization      

Example: Bearer Bearer {your-token-here}

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Query Parameters

page   integer  optional  

Número de página. Example: 1

per_page   integer  optional  

Registros por página (max 100). Example: 15

search   string  optional  

Búsqueda por nombre o email. Example: juan

status   string  optional  

Filtrar por estado (active, inactive, suspended). Example: active

role   string  optional  

Filtrar por rol (user, admin, moderator). Example: user

sort_by   string  optional  

Ordenar por campo. Example: created_at

sort_order   string  optional  

Orden (asc, desc). Example: desc

Body Parameters

page   integer  optional  

Must be at least 1. Example: 73

per_page   integer  optional  

Must be at least 1. Must not be greater than 100. Example: 13

search   string  optional  

Must not be greater than 100 characters. Example: qeopfuudtdsufvyvddqam

status   string  optional  

Example: suspended

Must be one of:
  • active
  • inactive
  • suspended
role   string  optional  

Example: user

Must be one of:
  • user
  • admin
  • moderator
sort_by   string  optional  

Example: name

Must be one of:
  • name
  • email
  • created_at
  • last_login_at
sort_order   string  optional  

Example: desc

Must be one of:
  • asc
  • desc

Mostrar usuario específico GET /api/users/{id}

Example request:
curl --request GET \
    --get "http://localhost/api/users/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/users/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/users/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Actualizar perfil del usuario PUT /api/users/{id}

Example request:
curl --request PUT \
    "http://localhost/api/users/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"name\": \"vmqeopfuudtdsufvyvddq\",
    \"email\": \"kunde.eloisa@example.com\",
    \"phone_number\": \"hfqcoynlazghdtqtq\",
    \"password\": \"(!Cs\'YAKYLk4>SJIrIV\"
}"
const url = new URL(
    "http://localhost/api/users/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "name": "vmqeopfuudtdsufvyvddq",
    "email": "kunde.eloisa@example.com",
    "phone_number": "hfqcoynlazghdtqtq",
    "password": "(!Cs'YAKYLk4>SJIrIV"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'name' => 'vmqeopfuudtdsufvyvddq',
            'email' => 'kunde.eloisa@example.com',
            'phone_number' => 'hfqcoynlazghdtqtq',
            'password' => '(!Cs\'YAKYLk4>SJIrIV',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PUT api/users/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Body Parameters

name   string  optional  

Must not be greater than 255 characters. Example: vmqeopfuudtdsufvyvddq

email   string  optional  

Must be a valid email address. Example: kunde.eloisa@example.com

phone_number   string  optional  

Must not be greater than 20 characters. Example: hfqcoynlazghdtqtq

password   string  optional  

Must be at least 8 characters. Example: (!Cs'YAKYLk4>SJIrIV

Eliminar usuario (soft delete) DELETE /api/users/{id}

Example request:
curl --request DELETE \
    "http://localhost/api/users/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/users/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

DELETE api/users/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Actualizar preferencias del usuario PUT /api/users/{id}/preferences

Example request:
curl --request PUT \
    "http://localhost/api/users/consequatur/preferences" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"preferences\": [],
    \"merge\": false
}"
const url = new URL(
    "http://localhost/api/users/consequatur/preferences"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "preferences": [],
    "merge": false
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur/preferences';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'preferences' => [],
            'merge' => false,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PUT api/users/{id}/preferences

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Body Parameters

preferences   object   
merge   boolean  optional  

Example: false

Subir foto de perfil POST /api/users/{id}/profile-photo

Example request:
curl --request POST \
    "http://localhost/api/users/consequatur/profile-photo" \
    --header "Content-Type: multipart/form-data" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --form "photo=@C:\Users\thejo\AppData\Local\Temp\php2D25.tmp" 
const url = new URL(
    "http://localhost/api/users/consequatur/profile-photo"
);

const headers = {
    "Content-Type": "multipart/form-data",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

const body = new FormData();
body.append('photo', document.querySelector('input[name="photo"]').files[0]);

fetch(url, {
    method: "POST",
    headers,
    body,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur/profile-photo';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'multipart/form-data',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'multipart' => [
            [
                'name' => 'photo',
                'contents' => fopen('C:\Users\thejo\AppData\Local\Temp\php2D25.tmp', 'r')
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/users/{id}/profile-photo

Headers

Content-Type      

Example: multipart/form-data

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Body Parameters

photo   file   

Must be an image. Must not be greater than 2048 kilobytes. Example: C:\Users\thejo\AppData\Local\Temp\php2D25.tmp

Obtener sesiones activas del usuario GET /api/users/{id}/sessions

Example request:
curl --request GET \
    --get "http://localhost/api/users/consequatur/sessions" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/users/consequatur/sessions"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur/sessions';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/users/{id}/sessions

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

Revocar sesión específica DELETE /api/users/{id}/sessions/{sessionId}

Example request:
curl --request DELETE \
    "http://localhost/api/users/consequatur/sessions/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/users/consequatur/sessions/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/users/consequatur/sessions/consequatur';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

DELETE api/users/{id}/sessions/{sessionId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the user. Example: consequatur

sessionId   string   

Example: consequatur

Sincronización

APIs para sincronización de datos entre la aplicación móvil y el servidor

Cargar datos desde el cliente

requires authentication

Recibe datos del cliente Android para sincronizar con el servidor.

Example request:
curl --request POST \
    "http://localhost/api/sync/upload" \
    --header "Authorization: Bearer Bearer {your-token-here}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"sync_items\": [
        {
            \"sync_type\": \"CREATE\",
            \"table_name\": \"questionnaires\",
            \"data\": {},
            \"timestamp\": 1234567890
        }
    ],
    \"device_id\": \"abc123\",
    \"session_id\": \"xyz789\"
}"
const url = new URL(
    "http://localhost/api/sync/upload"
);

const headers = {
    "Authorization": "Bearer Bearer {your-token-here}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "sync_items": [
        {
            "sync_type": "CREATE",
            "table_name": "questionnaires",
            "data": {},
            "timestamp": 1234567890
        }
    ],
    "device_id": "abc123",
    "session_id": "xyz789"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/upload';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer Bearer {your-token-here}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
            $o = [
                clone (($p = &\Symfony\Component\VarExporter\Internal\Registry::$prototypes)['stdClass'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('stdClass')),
                clone $p['stdClass'],
            ],
            null,
            [
                'stdClass' => [
                    'sync_type' => [
                        'CREATE',
                    ],
                    'table_name' => [
                        'questionnaires',
                    ],
                    'data' => [
                        $o[1],
                    ],
                    'timestamp' => [
                        1234567890,
                    ],
                ],
            ],
            [
                'sync_items' => [
                    $o[0],
                ],
                'device_id' => 'abc123',
                'session_id' => 'xyz789',
            ],
            []
        ),
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "message": "Sincronización completada",
    "data": {
        "processed": 5,
        "failed": 0
    }
}
 

Request      

POST api/sync/upload

Headers

Authorization      

Example: Bearer Bearer {your-token-here}

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

sync_items   string[]   

Items a sincronizar.

sync_type   string   

Tipo de operación (CREATE, UPDATE, DELETE, UPLOAD, DOWNLOAD). Example: CREATE

table_name   string   

Nombre de la tabla. Example: questionnaires

data   object   

Datos del item.

timestamp   integer   

Timestamp de la operación. Example: 1234567890

object_id   integer  optional  

ID del objeto. Example: 1

device_id   string   

ID del dispositivo. Example: abc123

session_id   string  optional  

ID de la sesión. Example: xyz789

Enviar actualizaciones al cliente POST /api/sync/download

Example request:
curl --request POST \
    "http://localhost/api/sync/download" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"last_sync\": 73,
    \"device_id\": \"consequatur\",
    \"tables\": [
        \"notifications\"
    ],
    \"limit\": 16
}"
const url = new URL(
    "http://localhost/api/sync/download"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "last_sync": 73,
    "device_id": "consequatur",
    "tables": [
        "notifications"
    ],
    "limit": 16
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/download';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'last_sync' => 73,
            'device_id' => 'consequatur',
            'tables' => [
                'notifications',
            ],
            'limit' => 16,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/sync/download

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

last_sync   integer  optional  

Must be at least 0. Example: 73

device_id   string   

CAMBIADO: nullable en lugar de required. Example: consequatur

tables   string[]  optional  
Must be one of:
  • users
  • questionnaires
  • settings
  • notifications
limit   integer  optional  

Must be at least 1. Must not be greater than 100. Example: 16

Obtener estado de sincronización GET /api/sync/status

Example request:
curl --request GET \
    --get "http://localhost/api/sync/status" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/sync/status"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/status';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/sync/status

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Gestionar cola de sincronización POST /api/sync/queue

Example request:
curl --request POST \
    "http://localhost/api/sync/queue" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"action\": \"list\",
    \"sync_type\": \"UPDATE\",
    \"table_name\": \"consequatur\",
    \"queue_id\": 17,
    \"priority\": 2,
    \"object_id\": 17
}"
const url = new URL(
    "http://localhost/api/sync/queue"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "action": "list",
    "sync_type": "UPDATE",
    "table_name": "consequatur",
    "queue_id": 17,
    "priority": 2,
    "object_id": 17
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/queue';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'action' => 'list',
            'sync_type' => 'UPDATE',
            'table_name' => 'consequatur',
            'queue_id' => 17,
            'priority' => 2,
            'object_id' => 17,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/sync/queue

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

action   string   

Example: list

Must be one of:
  • add
  • remove
  • clear
  • list
sync_type   string  optional  

This field is required when action is add. Example: UPDATE

Must be one of:
  • CREATE
  • UPDATE
  • DELETE
  • UPLOAD
  • DOWNLOAD
table_name   string  optional  

This field is required when action is add. Example: consequatur

data   string  optional  

This field is required when action is add.

queue_id   integer  optional  

This field is required when action is remove. Example: 17

priority   integer  optional  

Must be at least 1. Must not be greater than 3. Example: 2

object_id   integer  optional  

Example: 17

Sincronización masiva (batch) POST /api/sync/bulk

Example request:
curl --request POST \
    "http://localhost/api/sync/bulk" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"operations\": [
        {
            \"type\": \"download\",
            \"data\": \"consequatur\"
        }
    ],
    \"device_id\": \"consequatur\"
}"
const url = new URL(
    "http://localhost/api/sync/bulk"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "operations": [
        {
            "type": "download",
            "data": "consequatur"
        }
    ],
    "device_id": "consequatur"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/bulk';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'operations' => [
                [
                    'type' => 'download',
                    'data' => 'consequatur',
                ],
            ],
            'device_id' => 'consequatur',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/sync/bulk

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

operations   object[]   

Must have at least 1 items. Must not have more than 100 items.

type   string   

Example: download

Must be one of:
  • upload
  • download
data   string   

Example: consequatur

device_id   string   

Example: consequatur

Resolver conflictos de datos POST /api/sync/conflict

Example request:
curl --request POST \
    "http://localhost/api/sync/conflict" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest" \
    --data "{
    \"conflicts\": [
        {
            \"sync_log_id\": 17,
            \"resolution\": \"skip\"
        }
    ]
}"
const url = new URL(
    "http://localhost/api/sync/conflict"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

let body = {
    "conflicts": [
        {
            "sync_log_id": 17,
            "resolution": "skip"
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/conflict';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'json' => [
            'conflicts' => [
                [
                    'sync_log_id' => 17,
                    'resolution' => 'skip',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/sync/conflict

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Body Parameters

conflicts   object[]   

Must have at least 1 items.

sync_log_id   integer   

Example: 17

resolution   string   

Example: skip

Must be one of:
  • client_wins
  • server_wins
  • merge
  • skip
merged_data   string  optional  

This field is required when conflicts.*.resolution is merge.

Endpoint específico para cuestionarios GET /api/sync/questionnaires/status

Example request:
curl --request GET \
    --get "http://localhost/api/sync/questionnaires/status" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/sync/questionnaires/status"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/questionnaires/status';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/sync/questionnaires/status

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

General

GET api/sync/logs/{userId}

Example request:
curl --request GET \
    --get "http://localhost/api/sync/logs/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/sync/logs/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/logs/consequatur';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/sync/logs/{userId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

userId   string   

Example: consequatur

DELETE api/sync/clear/{userId}

Example request:
curl --request DELETE \
    "http://localhost/api/sync/clear/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/sync/clear/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/clear/consequatur';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

DELETE api/sync/clear/{userId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

userId   string   

Example: consequatur

GET api/sync/questionnaires/debug/{userId}

Example request:
curl --request GET \
    --get "http://localhost/api/sync/questionnaires/debug/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/sync/questionnaires/debug/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/sync/questionnaires/debug/consequatur';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/sync/questionnaires/debug/{userId}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

userId   string   

Example: consequatur

GET api/questionnaires/android/list

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/android/list" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/android/list"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/android/list';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/android/list

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/questionnaires/android/unsynced

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/android/unsynced" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/android/unsynced"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/android/unsynced';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/android/unsynced

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me

Example request:
curl --request GET \
    --get "http://localhost/api/me" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

PUT api/me

Example request:
curl --request PUT \
    "http://localhost/api/me" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PUT api/me

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

PUT api/me/preferences

Example request:
curl --request PUT \
    "http://localhost/api/me/preferences" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/preferences"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/preferences';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PUT api/me/preferences

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

POST api/me/profile-photo

Example request:
curl --request POST \
    "http://localhost/api/me/profile-photo" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/profile-photo"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/profile-photo';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/me/profile-photo

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/sessions

Example request:
curl --request GET \
    --get "http://localhost/api/me/sessions" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/sessions"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/sessions';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/sessions

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/stats

Example request:
curl --request GET \
    --get "http://localhost/api/me/stats" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/stats"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/stats';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/stats

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/questionnaires

Example request:
curl --request GET \
    --get "http://localhost/api/me/questionnaires" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/questionnaires"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/questionnaires';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/questionnaires

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/questionnaires/stats

Example request:
curl --request GET \
    --get "http://localhost/api/me/questionnaires/stats" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/questionnaires/stats"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/questionnaires/stats';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/questionnaires/stats

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/questionnaires/recent

Example request:
curl --request GET \
    --get "http://localhost/api/me/questionnaires/recent" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/questionnaires/recent"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/questionnaires/recent';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/questionnaires/recent

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/me/questionnaires/pending-sync

Example request:
curl --request GET \
    --get "http://localhost/api/me/questionnaires/pending-sync" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/me/questionnaires/pending-sync"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/me/questionnaires/pending-sync';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/me/questionnaires/pending-sync

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/admin/stats

Example request:
curl --request GET \
    --get "http://localhost/api/admin/stats" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/admin/stats"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/admin/stats';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/admin/stats

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/admin/questionnaires/stats

Example request:
curl --request GET \
    --get "http://localhost/api/admin/questionnaires/stats" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/admin/questionnaires/stats"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/admin/questionnaires/stats';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/admin/questionnaires/stats

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

POST api/admin/cleanup

Example request:
curl --request POST \
    "http://localhost/api/admin/cleanup" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/admin/cleanup"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/admin/cleanup';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/admin/cleanup

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

POST api/admin/users/bulk-action

Example request:
curl --request POST \
    "http://localhost/api/admin/users/bulk-action" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/admin/users/bulk-action"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/admin/users/bulk-action';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/admin/users/bulk-action

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/notifications

Example request:
curl --request GET \
    --get "http://localhost/api/notifications" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/notifications"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/notifications';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/notifications

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

POST api/notifications/mark-read/{id}

Example request:
curl --request POST \
    "http://localhost/api/notifications/mark-read/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/notifications/mark-read/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/notifications/mark-read/consequatur';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/notifications/mark-read/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   string   

The ID of the mark read. Example: consequatur

GET api/config

Example request:
curl --request GET \
    --get "http://localhost/api/config" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/config"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/config';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/config

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/config/questionnaires

Example request:
curl --request GET \
    --get "http://localhost/api/config/questionnaires" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/config/questionnaires"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/config/questionnaires';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/config/questionnaires

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

GET api/{fallbackPlaceholder}

Example request:
curl --request GET \
    --get "http://localhost/api/2UZ5i" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/2UZ5i"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/2UZ5i';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 

{
    "success": false,
    "message": "Endpoint no encontrado",
    "error_code": "NOT_FOUND",
    "available_endpoints": {
        "auth": "/api/auth/{login,register,logout}",
        "users": "/api/users",
        "sync": "/api/sync/{upload,download,status}",
        "questionnaires": "/api/questionnaires",
        "me": "/api/me",
        "admin": "/api/admin"
    },
    "questionnaire_endpoints": {
        "list": "GET /api/questionnaires",
        "create": "POST /api/questionnaires",
        "show": "GET /api/questionnaires/{id}",
        "update": "PUT /api/questionnaires/{id}",
        "delete": "DELETE /api/questionnaires/{id}",
        "stats": "GET /api/questionnaires/stats/summary",
        "search": "GET /api/questionnaires/search/query",
        "export": "GET /api/questionnaires/export/data"
    }
}
 

Request      

GET api/{fallbackPlaceholder}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

fallbackPlaceholder   string   

Example: 2UZ5i

CEDIS

APIs para gestionar centros de distribución (CEDIS)

Obtener CEDIS activos

Retorna únicamente los CEDIS que están marcados como activos, ordenados alfabéticamente por nombre.

Example request:
curl --request GET \
    --get "http://localhost/api/cedis/active" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/cedis/active"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/cedis/active';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "nombre": "CEDIS Ciudad de México",
            "codigo": "CDMX-001",
            "activo": true,
            "created_at": "2024-01-15T10:00:00.000000Z",
            "updated_at": "2024-01-15T10:00:00.000000Z"
        },
        {
            "id": 2,
            "nombre": "CEDIS Guadalajara",
            "codigo": "GDL-001",
            "activo": true,
            "created_at": "2024-01-15T10:00:00.000000Z",
            "updated_at": "2024-01-15T10:00:00.000000Z"
        }
    ],
    "total": 2
}
 

Example response (500):


{
    "success": false,
    "message": "Error al obtener los CEDIS activos",
    "error": "Database connection failed"
}
 

Request      

GET api/cedis/active

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Listar todos los CEDIS

Obtiene la lista completa de CEDIS con opciones de filtrado.

Example request:
curl --request GET \
    --get "http://localhost/api/cedis?activo=1&search=CDMX" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/cedis"
);

const params = {
    "activo": "1",
    "search": "CDMX",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/cedis';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'query' => [
            'activo' => '1',
            'search' => 'CDMX',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "data": [
        {
            "id": 1,
            "nombre": "CEDIS Ciudad de México",
            "codigo": "CDMX-001",
            "activo": true,
            "created_at": "2024-01-15T10:00:00.000000Z",
            "updated_at": "2024-01-15T10:00:00.000000Z"
        }
    ],
    "total": 1
}
 

Example response (422):


{
    "success": false,
    "message": "Parámetros inválidos",
    "errors": {
        "activo": [
            "El campo activo debe ser verdadero o falso"
        ]
    }
}
 

Request      

GET api/cedis

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Query Parameters

activo   boolean  optional  

Filtrar por estado activo/inactivo. Example: true

search   string  optional  

Buscar por nombre o código. Example: CDMX

Obtener un CEDIS específico

Recupera la información detallada de un CEDIS por su ID.

Example request:
curl --request GET \
    --get "http://localhost/api/cedis/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/cedis/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/cedis/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "data": {
        "id": 1,
        "nombre": "CEDIS Ciudad de México",
        "codigo": "CDMX-001",
        "activo": true,
        "created_at": "2024-01-15T10:00:00.000000Z",
        "updated_at": "2024-01-15T10:00:00.000000Z"
    }
}
 

Example response (404):


{
    "success": false,
    "message": "CEDIS no encontrado"
}
 

Request      

GET api/cedis/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   integer   

ID del CEDIS. Example: 1

Cuestionarios

APIs para gestión de cuestionarios con soporte de sincronización offline

Listar cuestionarios

requires authentication

Obtiene la lista de cuestionarios del usuario con filtros y paginación.

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires?page=1&per_page=20&folio=F-001&cedis=CDMX&cuadrilla=A&sync_status=synced&date_from=2024-01-01&date_to=2024-01-31&sort_by=created_at&sort_order=desc" \
    --header "Authorization: Bearer Bearer {your-token-here}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires"
);

const params = {
    "page": "1",
    "per_page": "20",
    "folio": "F-001",
    "cedis": "CDMX",
    "cuadrilla": "A",
    "sync_status": "synced",
    "date_from": "2024-01-01",
    "date_to": "2024-01-31",
    "sort_by": "created_at",
    "sort_order": "desc",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {your-token-here}",
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer Bearer {your-token-here}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
        'query' => [
            'page' => '1',
            'per_page' => '20',
            'folio' => 'F-001',
            'cedis' => 'CDMX',
            'cuadrilla' => 'A',
            'sync_status' => 'synced',
            'date_from' => '2024-01-01',
            'date_to' => '2024-01-31',
            'sort_by' => 'created_at',
            'sort_order' => 'desc',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):


{
    "success": true,
    "data": {
        "questionnaires": [
            {
                "id": 1,
                "folio": "F-001",
                "cedis": "CDMX",
                "sync_status": "synced"
            }
        ],
        "total": 100,
        "page": 1,
        "per_page": 20
    }
}
 

Request      

GET api/questionnaires

Headers

Authorization      

Example: Bearer Bearer {your-token-here}

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Query Parameters

page   integer  optional  

Número de página. Example: 1

per_page   integer  optional  

Registros por página (max 100). Example: 20

folio   string  optional  

Filtrar por folio. Example: F-001

cedis   string  optional  

Filtrar por CEDIS. Example: CDMX

cuadrilla   string  optional  

Filtrar por cuadrilla. Example: A

sync_status   string  optional  

Estado de sincronización (synced, unsynced, error). Example: synced

date_from   string  optional  

date Fecha desde. Example: 2024-01-01

date_to   string  optional  

date Fecha hasta. Example: 2024-01-31

sort_by   string  optional  

Ordenar por (created_at, questionnaire_timestamp, folio). Example: created_at

sort_order   string  optional  

Orden (asc, desc). Example: desc

Crear nuevo cuestionario POST /api/questionnaires

Example request:
curl --request POST \
    "http://localhost/api/questionnaires" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/questionnaires

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Mostrar cuestionario específico GET /api/questionnaires/{questionnaire}

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/33" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/33"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/33';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   integer   

The ID of the questionnaire. Example: 33

Actualizar cuestionario PUT/PATCH /api/questionnaires/{questionnaire}

Example request:
curl --request PUT \
    "http://localhost/api/questionnaires/33" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/33"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/33';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PUT api/questionnaires/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   integer   

The ID of the questionnaire. Example: 33

Actualizar cuestionario PUT/PATCH /api/questionnaires/{questionnaire}

Example request:
curl --request PATCH \
    "http://localhost/api/questionnaires/33" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/33"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "PATCH",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/33';
$response = $client->patch(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

PATCH api/questionnaires/{questionnaire_id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

questionnaire_id   integer   

The ID of the questionnaire. Example: 33

Eliminar cuestionario DELETE /api/questionnaires/{questionnaire}

Example request:
curl --request DELETE \
    "http://localhost/api/questionnaires/33" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/33"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/33';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

DELETE api/questionnaires/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

id   integer   

The ID of the questionnaire. Example: 33

Obtener estadísticas de cuestionarios GET /api/questionnaires/stats

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/stats/summary" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/stats/summary"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/stats/summary';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/stats/summary

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Buscar cuestionarios GET /api/questionnaires/search

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/search/query" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/search/query"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/search/query';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/search/query

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Exportar cuestionarios GET /api/questionnaires/export

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/export/data" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/export/data"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/export/data';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/export/data

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Obtener cuestionarios duplicados por folio GET /api/questionnaires/duplicates

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/duplicates/list" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/duplicates/list"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/duplicates/list';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/duplicates/list

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Validate the given request with the given rules.

Example request:
curl --request POST \
    "http://localhost/api/questionnaires/validate/check" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/validate/check"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/validate/check';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/questionnaires/validate/check

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Marcar cuestionarios como sincronizados POST /api/questionnaires/mark-synced

Example request:
curl --request POST \
    "http://localhost/api/questionnaires/bulk/mark-synced" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/bulk/mark-synced"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/bulk/mark-synced';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/questionnaires/bulk/mark-synced

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

Verificar existencia y estado de sincronización de un cuestionario por folio y cedis GET /api/questionnaires/verify/{folio}?cedis=CDMX

Example request:
curl --request GET \
    --get "http://localhost/api/questionnaires/verify/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/verify/consequatur"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/verify/consequatur';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/questionnaires/verify/{folio}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

folio   string   

Example: consequatur

Resetear estado de sincronización POST /api/questionnaires/{questionnaire}/reset-sync

Example request:
curl --request POST \
    "http://localhost/api/questionnaires/33/reset-sync" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "X-Requested-With: XMLHttpRequest"
const url = new URL(
    "http://localhost/api/questionnaires/33/reset-sync"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-Requested-With": "XMLHttpRequest",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'http://localhost/api/questionnaires/33/reset-sync';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'X-Requested-With' => 'XMLHttpRequest',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Request      

POST api/questionnaires/{questionnaire_id}/reset-sync

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

X-Requested-With      

Example: XMLHttpRequest

URL Parameters

questionnaire_id   integer   

The ID of the questionnaire. Example: 33