MENU navbar-image

Introduction

funciona alg

Documentación general de la API .

Authenticating requests

This API is not authenticated.

Autenticación

Iniciar sesión

Este endpoint permite autenticar a un usuario mediante correo y contraseña. Si las credenciales son correctas, devuelve un token que se utilizará para autenticar las siguientes peticiones.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"qkunze@example.com\",
    \"password\": \"O[2UZ5ij-e\\/dl4m{o,\"
}"
const url = new URL(
    "https://www.nexasplay.com/api/login"
);

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

let body = {
    "email": "qkunze@example.com",
    "password": "O[2UZ5ij-e\/dl4m{o,"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
    "token_type": "bearer",
    "expires_in": 60
}
 

Example response (401):


{
    "error": "Unauthorized"
}
 

Request      

POST api/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Correo electrónico del usuario. Ejemplo: cliente1@nexaxplay.com Example: qkunze@example.com

password   string   

Contraseña del usuario. Ejemplo: 123456789 Example: O[2UZ5ij-e/dl4m{o,

Registrar un nuevo usuario.

Permite crear un nuevo usuario en el sistema proporcionando los datos personales requeridos. Retorna un token JWT para autenticación posterior.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/register" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"first_name\": \"consequatur\",
    \"last_name\": \"consequatur\",
    \"email\": \"qkunze@example.com\",
    \"password\": \"O[2UZ5ij-e\\/dl4m{o,\",
    \"phone\": \"consequatur\",
    \"password_confirmation\": \"consequatur\",
    \"birthdate\": \"consequatur\",
    \"gender\": \"consequatur\",
    \"current_city\": \"consequatur\"
}"
const url = new URL(
    "https://www.nexasplay.com/api/register"
);

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

let body = {
    "first_name": "consequatur",
    "last_name": "consequatur",
    "email": "qkunze@example.com",
    "password": "O[2UZ5ij-e\/dl4m{o,",
    "phone": "consequatur",
    "password_confirmation": "consequatur",
    "birthdate": "consequatur",
    "gender": "consequatur",
    "current_city": "consequatur"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
    "token_type": "bearer",
    "expires_in": 60
}
 

Example response (422):


{
    "email": [
        "The email has already been taken."
    ]
}
 

Request      

POST api/register

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

first_name   string   

Nombre del usuario. Ejemplo: Sean Example: consequatur

last_name   string   

Apellido del usuario. Ejemplo: paul Example: consequatur

email   string   

Correo electrónico válido y único. Ejemplo: seanpuol@gmail.com Example: qkunze@example.com

password   string   

Contraseña con mínimo 8 caracteres. Ejemplo: 123456789 Example: O[2UZ5ij-e/dl4m{o,

phone   string   

Número de teléfono único. Ejemplo: 30243614512 Example: consequatur

password_confirmation   string   

Confirmación de la contraseña. Ejemplo: 123456789 Example: consequatur

birthdate   date   

Fecha de nacimiento en formato Y-m-d. Ejemplo: 1989-04-15 Example: consequatur

gender   string   

Género del usuario (M o F). Ejemplo: M Example: consequatur

current_city   string   

Ciudad actual del usuario. Ejemplo: Pasto Example: consequatur

Cerrar sesión

Este endpoint cierra la sesión del usuario autenticado invalidando su token JWT. Después de cerrar sesión, el token ya no será válido para futuras peticiones.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/logout" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/logout"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Successfully logged out"
}
 

Example response (401):


{
    "message": "Token inválido o expirado"
}
 

Request      

POST api/logout

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Refrescar token JWT

Este endpoint permite renovar el token JWT del usuario autenticado cuando está próximo a expirar. Devuelve un nuevo token válido que debe reemplazar al anterior en las siguientes peticiones.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/refresh" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/refresh"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
    "token_type": "bearer",
    "expires_in": 60
}
 

Example response (401):


{
    "message": "Token inválido o expirado"
}
 

Request      

POST api/refresh

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Obtener token de acceso desde una API Key

Este endpoint genera un token JWT válido para el usuario asociado a una API Key. Se usa cuando un sistema externo necesita autenticarse sin usar usuario y contraseña.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"key\": \"consequatur\"
}"
const url = new URL(
    "https://www.nexasplay.com/api/token"
);

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

let body = {
    "key": "consequatur"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
 

Example response (400):


{
    "message": "Invalid Api Key"
}
 

Example response (401):


{
    "message": "Unauthorized"
}
 

Request      

POST api/token

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

key   string   

Clave API válida asociada a un usuario. Ejemplo: 4f9b28b5e912f7a2b1d4c8e7 Example: consequatur

Endpoints

POST api/match/join

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/join" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/join"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/match/join

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

POST api/match/playcard/{room_name}

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/playcard/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/playcard/consequatur"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/match/playcard/{room_name}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

room_name   string   

Example: consequatur

GET api/rooms/{room_id}

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/rooms/17" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/rooms/17"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

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

{
    "message": "Unauthenticated."
}
 

Request      

GET api/rooms/{room_id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

room_id   integer   

The ID of the room. Example: 17

Devuelve los saldos actuales del usuario autenticado.

Corresponde al endpoint GET /api/user/balances

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/user/balances" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/user/balances"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/user/balances

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

GET api/user

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/user" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/user"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

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

{
    "message": "Unauthenticated."
}
 

Request      

GET api/user

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Inicia una partida para el usuario autenticado.

Corresponde al endpoint: POST /api/minigames/{minigame}/play

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/minigames/1/play" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"payment_method\": \"consequatur\",
    \"event_id\": \"consequatur\"
}"
const url = new URL(
    "https://www.nexasplay.com/api/minigames/1/play"
);

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

let body = {
    "payment_method": "consequatur",
    "event_id": "consequatur"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/minigames/{minigame_id}/play

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

minigame_id   integer   

The ID of the minigame. Example: 1

Body Parameters

payment_method   string   

Example: consequatur

event_id   string   

The id of an existing record in the events table. Example: consequatur

Guarda la puntuación del usuario al finalizar una partida.

Corresponde al endpoint: POST /api/scores

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/scores" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"minigame_id\": \"consequatur\",
    \"event_id\": \"consequatur\",
    \"score\": 45
}"
const url = new URL(
    "https://www.nexasplay.com/api/scores"
);

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

let body = {
    "minigame_id": "consequatur",
    "event_id": "consequatur",
    "score": 45
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/scores

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

minigame_id   string   

The id of an existing record in the minigames table. Example: consequatur

event_id   string   

The id of an existing record in the events table. Example: consequatur

score   integer   

Must be at least 0. Example: 45

GET api/{datatype}

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/consequatur"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

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

{
    "message": "Unauthenticated."
}
 

Request      

GET api/{datatype}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

datatype   string   

Example: consequatur

GET api/{datatype}/{id}

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/consequatur/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/consequatur/consequatur"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

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

{
    "message": "Unauthenticated."
}
 

Request      

GET api/{datatype}/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

datatype   string   

Example: consequatur

id   string   

The ID of the {datatype}. Example: consequatur

PUT api/{datatype}/{id}

Example request:
curl --request PUT \
    "https://www.nexasplay.com/api/consequatur/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/consequatur/consequatur"
);

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

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/{datatype}/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

datatype   string   

Example: consequatur

id   string   

The ID of the {datatype}. Example: consequatur

POST api/{datatype}

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/consequatur"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/{datatype}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

datatype   string   

Example: consequatur

DELETE api/{datatype}/{id}

Example request:
curl --request DELETE \
    "https://www.nexasplay.com/api/consequatur/consequatur" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/consequatur/consequatur"
);

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

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/{datatype}/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

datatype   string   

Example: consequatur

id   string   

The ID of the {datatype}. Example: consequatur

Filtros

Listar y Filtrar Compañías

Muestra una lista paginada de compañías. Permite múltiples filtros y opciones de ordenamiento para descubrir compañías.

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/companies-filters?label=Restaurante&has_active_events=1&sort_by=rating" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/companies-filters"
);

const params = {
    "label": "Restaurante",
    "has_active_events": "1",
    "sort_by": "rating",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": [
        {
            "id": 1,
            "name": "Company 1",
            "logoUrl": null,
            "description": "This company.",
            "phone": "3121231230",
            "catalogUrl": null,
            "schedule": null,
            "address": null,
            "city": "Pasto",
            "location": "1.2136,-77.2793",
            "gameRoomUrl": null
        }
    ]
}
 

Example response (404):


{
    "message": "No query results for model [App\\Models\\Company] 99"
}
 

Request      

GET api/companies-filters

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

label   string  optional  

Filtrar compañías por el nombre de una etiqueta. Example: Restaurante

has_active_events   boolean  optional  

Filtrar compañías que tengan al menos un evento activo. Example: true

sort_by   string  optional  

Ordenar los resultados. Opciones: 'rating' (mejor a peor calificada). Example: rating

Buscar compañías cercanas

Este endpoint permite buscar compañías cercanas a una ubicación geográfica utilizando latitud, longitud y un radio (en km).

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/companies-filters/nearby?lat=-12.0464&lng=-77.0428&radius=10" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"lat\": -89,
    \"lng\": -180,
    \"radius\": 16
}"
const url = new URL(
    "https://www.nexasplay.com/api/companies-filters/nearby"
);

const params = {
    "lat": "-12.0464",
    "lng": "-77.0428",
    "radius": "10",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

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

let body = {
    "lat": -89,
    "lng": -180,
    "radius": 16
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
"data": [
  {
    "id": 1,
    "name": "Arcade Central Pasto",
    "logoUrl": null,
    "description": "La mejor sala de juegos de Nariño.",
    "phone": null,
    "catalogUrl": null,
    "schedule": null,
    "address": null,
    "city": "Pasto",
    "location": "1.213615,-77.279343",
    "gameRoomUrl": null,
    "distance": 0.01
  },
]}
 

Request      

GET api/companies-filters/nearby

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

lat   string   

float Latitud actual del usuario. Example: -12.0464

lng   string   

float Longitud actual del usuario. Example: -77.0428

radius   number  optional  

Radio de búsqueda en kilómetros (por defecto: 25 km). Mínimo: 1, máximo: 100. Example: 10

Body Parameters

lat   number   

Must be between -90 and 90. Example: -89

lng   number   

Must be between -180 and 180. Example: -180

radius   number  optional  

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

Obtener calificación compañia

Calcula y devuelve la calificación promedio (de 1 a 5) y el número total de reseñas para una compañía específica.

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/companies-filters/1/average-rating" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/companies-filters/1/average-rating"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "data": {
        "company_id": 1,
        "average_rating": "4.3",
        "review_count": 15
    }
}
 

Example response (404):


{
    "message": "No query results for model [App\\Models\\Company] 99"
}
 

Request      

GET api/companies-filters/{company_id}/average-rating

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

company_id   string   

El ID de la compañía. Example: 1

Listar y filtrar Eventos

Muestra una lista paginada de todos los eventos que están actualmente activos. Permite filtrar por ciudad, compañía o por los minijuegos incluidos en el evento. Los eventos se ordenan por los más recientes primero.

Example request:
curl --request GET \
    --get "https://www.nexasplay.com/api/events-filters?city=Pasto&company_id=1&minigame_id=2" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/events-filters"
);

const params = {
    "city": "Pasto",
    "company_id": "1",
    "minigame_id": "2",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
"data": [
  {
    "id": 1,
    "description": "Gran Torneo de Verano",
    "duration": "7 days",
    "isActive": true,
    "city": "Pasto",
    "company": {
      "id": 1,
      "name": "Arcade Central Pasto"
    },
  "minigames": [
      {
        "id": 1,
        "name": "Space Invaders"
      },
      {
        "id": 2,
        "name": "Tetris Challenge"
      }
    ]
  }
],
}
 

Request      

GET api/events-filters

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

city   string  optional  

Filtrar eventos por ciudad (búsqueda parcial). Example: Pasto

company_id   integer  optional  

Filtrar eventos por el ID de la compañía organizadora. Example: 1

minigame_id   integer  optional  

Filtrar eventos que incluyan un minijuego específico por su ID. Example: 2

Rooms

Crear una nueva sala de juego.

requires authentication

Este endpoint permite crear una sala automáticamente con un nombre único y asignar al usuario autenticado como propietario. La sala puede ser pública o privada según el parámetro enviado.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/create" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"privacidad\": \"publica\"
}"
const url = new URL(
    "https://www.nexasplay.com/api/match/create"
);

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

let body = {
    "privacidad": "publica"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
  "status": "success",
  "data": {
    "id": 1,
    "name": "Room-ABCD12",
    "owner_id": 5,
    "status": "creada",
    "privacidad": "publica",
    "created_at": "2025-10-08T16:41:12.000000Z",
    "updated_at": "2025-10-08T16:41:12.000000Z"
  }
} "La respuesta incluye los datos completos de la sala creada, mostrando su estado inicial, privacidad y propietario."
 

Example response (401):


{
  "message": "Unauthenticated."
} "Se retorna cuando el usuario no está autenticado y no puede crear la sala."
 

Request      

POST api/match/create

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

privacidad   string   

Define la privacidad de la sala. Puede ser "publica" o "privada". Example: publica

Unirse a una sala privada.

requires authentication

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/join/Room-ABCD12" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/join/Room-ABCD12"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "data": {
        "room_name": "Room-ABCD12",
        "users": [
            {
                "id": 1,
                "name": "Harvey"
            },
            {
                "id": 2,
                "name": "Pablo"
            }
        ],
        "user_count": 2
    }
}
 

Example response (403):


{
    "status": "error",
    "message": "La sala ya está completa."
}
 

Example response (404):


{
    "status": "error",
    "message": "Sala no encontrada."
}
 

Example response (423):


{
    "status": "error",
    "message": "Otro usuario está uniéndose a la sala, intenta de nuevo."
}
 

Request      

POST api/match/join/{room_name}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

room_name   string   

Nombre de la sala a la que el usuario quiere unirse. Example: Room-ABCD12

Unirse a una sala pública de forma aleatoria.

requires authentication

Busca una sala pública con espacio disponible (máximo 2 jugadores). Si existe, el usuario se une a ella. Si no existe, se crea una nueva sala pública y el usuario se convierte en su propietario.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/joinramdon" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/joinramdon"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Te uniste a una sala pública existente.",
    "data": {
        "room_name": "Room-XYZ123",
        "users": [
            {
                "id": 5,
                "first_name": "Harvey"
            },
            {
                "id": 7,
                "first_name": "Carlos"
            }
        ],
        "user_count": 2
    }
}
 

Example response (201):


{
    "status": "created",
    "message": "No había sala disponible, se creó una nueva pública.",
    "data": {
        "room_name": "Room-ABCD12",
        "users": [
            {
                "id": 5,
                "first_name": "Harvey"
            }
        ],
        "user_count": 1
    }
}
 

Example response (423):


{
    "status": "error",
    "message": "Otro usuario está uniéndose a una sala, intenta de nuevo."
}
 

Request      

POST api/match/joinramdon

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Iniciar una partida.

requires authentication

Verifica si el usuario pertenece a la sala y si hay al menos 2 jugadores para poder iniciar la partida , la idea general es que cuando se cree la sala o se una a la sala ramdon o privada lo pase al star para ver el contrincante.

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/start/Room-ABCD12" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/start/Room-ABCD12"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "status": "incompleto",
    "users": [
        {
            "id": 5,
            "first_name": "Carlos"
        }
    ],
    "message": "Esperando jugadores."
}
 

Example response (200):


{
    "status": "success",
    "message": "Partida iniciada.",
    "data": {
        "room_name": "Room-ABCD12",
        "users": [
            {
                "id": 5,
                "first_name": "Carlos"
            },
            {
                "id": 6,
                "first_name": "Ana"
            }
        ]
    }
}
 

Example response (403):


{
    "status": "error",
    "message": "No tienes acceso a esta sala."
}
 

Example response (404):


{
    "status": "error",
    "message": "Sala no encontrada."
}
 

Request      

POST api/match/start/{room_name}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

room_name   string   

El nombre único de la sala. Example: Room-ABCD12

Repartir cartas a un jugador en la sala.

requires authentication

Example request:
curl --request POST \
    "https://www.nexasplay.com/api/match/deal/Room-ABCD12" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://www.nexasplay.com/api/match/deal/Room-ABCD12"
);

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

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "status": "success",
    "message": "Cartas asignadas.",
    "cards": [
        {
            "id": 12,
            "name": "Fuego Básico",
            "element": "fire",
            "power": 3,
            "sprite_key": "fire_basic",
            "win_effect": "fire_blast",
            "lose_effect": "smoke"
        },
        {
            "id": 20,
            "name": "Agua Básica",
            "element": "water",
            "power": 2,
            "sprite_key": "water_basic",
            "win_effect": "water_splash",
            "lose_effect": "drowned"
        }
    ]
}
 

Example response (403):


{
    "status": "error",
    "message": "No tienes acceso a esta sala."
}
 

Example response (404):


{
    "status": "error",
    "message": "Sala no encontrada."
}
 

Request      

POST api/match/deal/{room_name}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

room_name   string   

Nombre único de la sala. Example: Room-ABCD12