/vendorsvendors.readListar la tienda autorizada
Un PAT válido está vinculado a una sola tienda. La respuesta conserva el formato de lista para futuras autorizaciones multitienda.
Ver contrato y ejemplos
Ejemplos
IDs y datos ficticios. Adapta los valores a tu tienda y revisa la autoridad antes de cualquier escritura.
Tienda vinculada al PAT
Tienda vinculada al PAT
Solicitud · ejemplo ilustrativo
cURL
: "${MOKU_PAT:?}" &&
curl --silent --show-error --fail-with-body \
'https://moku.cl/api/v1/vendors' \
--header "Authorization: Bearer ${MOKU_PAT}" \
--header 'Accept: application/json'PHP
Ejemplo para PHP CLI con la extensión cURL. No es un plugin de WordPress ni debe ejecutarse en el navegador.
<?php
$token = getenv('MOKU_PAT');
if ($token === false || $token === '') {
throw new RuntimeException('MOKU_PAT');
}
$url = 'https://moku.cl/api/v1/vendors';
$curl = curl_init($url);
if ($curl === false) {
throw new RuntimeException('curl_init');
}
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Authorization: Bearer ' . $token,
],
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException($message);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);
$result = json_decode($response, false, 512, JSON_THROW_ON_ERROR);
$failed = $status < 200 || $status >= 300;
if ($failed) {
fwrite(STDERR, "HTTP {$status}\n");
}
fwrite(
$failed ? STDERR : STDOUT,
json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL
);
exit($failed ? 1 : 0);Respuesta 200 application/json
{
"data": [
{
"id": "vendor_demo_ceramica",
"name": "Cerámica de ejemplo",
"slug": "ceramica-de-ejemplo"
}
]
}
Token ausente o no válido
Token ausente o no válido
Solicitud · ejemplo ilustrativo
cURL
curl --silent --show-error --fail-with-body \
'https://moku.cl/api/v1/vendors' \
--header 'Accept: application/json'PHP
Ejemplo para PHP CLI con la extensión cURL. No es un plugin de WordPress ni debe ejecutarse en el navegador.
<?php
$url = 'https://moku.cl/api/v1/vendors';
$curl = curl_init($url);
if ($curl === false) {
throw new RuntimeException('curl_init');
}
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
],
]);
$response = curl_exec($curl);
if ($response === false) {
$message = curl_error($curl);
curl_close($curl);
throw new RuntimeException($message);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);
$result = json_decode($response, false, 512, JSON_THROW_ON_ERROR);
$failed = $status < 200 || $status >= 300;
if ($failed) {
fwrite(STDERR, "HTTP {$status}\n");
}
fwrite(
$failed ? STDERR : STDOUT,
json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR) . PHP_EOL
);
exit($failed ? 1 : 0);Respuesta 401 application/problem+json
{
"type": "https://developers.moku.cl/reference/errors/#unauthenticated",
"title": "Authentication required",
"status": 401,
"code": "UNAUTHENTICATED",
"detail": "Provide a valid Moku personal access token.",
"request_id": "req_00000000000000000000000000000002"
}
Respuestas
Respuesta 200
Granted vendors
application/json
- Esta regla no permite propiedades adicionales.
Cabeceras de respuesta
X-Request-IdstringServer-generated request identifier to include in support requests.
string
RateLimit-LimitintegerRequest allocation assigned to this credential for the current one-minute window. A replacement credential may inherit the same vendor slot.
- Mínimo
1
- Mínimo
RateLimit-RemainingintegerRequests remaining in the credential's assigned vendor slot for the current window.
- Mínimo
0
- Mínimo
RateLimit-ResetintegerUnix timestamp in seconds when the current window resets.
- Mínimo
0
- Mínimo
Errores
Estos son los estados HTTP declarados para esta operación. El código problem+json indica la causa concreta. Consultar códigos y reintentos seguros
401 · Token no válido
The bearer token is missing, invalid, expired, revoked, or no longer owned by the vendor owner.
application/problem+json · Problem
Cabeceras de respuesta
X-Request-IdstringServer-generated request identifier to include in support requests.
string
WWW-Authenticatestringstring
403 · Permiso insuficiente
The token lacks the required scope.
application/problem+json · Problem
Cabeceras de respuesta
X-Request-IdstringServer-generated request identifier to include in support requests.
string
429 · Límite de solicitudes
The credential's vendor allocation exceeded its one-minute limit: 60 reads or 12 writes. Revoking and replacing a credential does not reset the window.
application/problem+json · Problem
Cabeceras de respuesta
X-Request-IdstringServer-generated request identifier to include in support requests.
string
Retry-Afterinteger- Mínimo
1
- Mínimo
503 · Servicio no disponible
Authentication, catalog, inventory, or rate-limit state could not be checked safely.
application/problem+json · Problem
Cabeceras de respuesta
X-Request-IdstringServer-generated request identifier to include in support requests.
string
Retry-Afterinteger- Mínimo
1
- Mínimo
Campos de Problem (sin envoltura data)
object- Esta regla no permite propiedades adicionales.
-
- Formato
"uri"
- Formato
-
string
-
integer
-
string
-
string
-
string
Las notas técnicas en inglés se muestran tal como están publicadas en OpenAPI. Los campos y restricciones se generan desde ese contrato. Descargar contrato OpenAPI