/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'Node.js
Módulo ES para Node.js 18 o posterior (guárdalo, por ejemplo, como ejemplo.mjs). Usa el fetch incluido, sin dependencias. No debe ejecutarse en el navegador.
const token = process.env.MOKU_PAT;
if (!token) throw new Error('MOKU_PAT');
const url = new URL('https://moku.cl/api/v1/vendors');
const response = await fetch(url, {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${token}`,
},
signal: AbortSignal.timeout(30_000),
});
const result = await response.json();
if (!response.ok) console.error(`HTTP ${response.status}`);
(response.ok ? console.log : console.error)(JSON.stringify(result, null, 2));
process.exitCode = response.ok ? 0 : 1;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'Node.js
Módulo ES para Node.js 18 o posterior (guárdalo, por ejemplo, como ejemplo.mjs). Usa el fetch incluido, sin dependencias. No debe ejecutarse en el navegador.
const url = new URL('https://moku.cl/api/v1/vendors');
const response = await fetch(url, {
method: 'GET',
headers: {
Accept: 'application/json',
},
signal: AbortSignal.timeout(30_000),
});
const result = await response.json();
if (!response.ok) console.error(`HTTP ${response.status}`);
(response.ok ? console.log : console.error)(JSON.stringify(result, null, 2));
process.exitCode = response.ok ? 0 : 1;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
-
Stable public error code. Each code has a recovery entry at its type URL.
- Valores permitidos
"AUTHORITY_CONFLICT" · "CONNECTION_STATE_CONFLICT" · "EXTERNAL_ORDER_LINES_LOCKED" · "EXTERNAL_ORDER_SOURCE_CONFLICT" · "EXTERNAL_ORDER_STALE" · "EXTERNAL_ORDER_TERMINAL" · "EXTERNAL_ORDER_TERMINAL_REVIEW_REQUIRED" · "FULFILLMENT_REVIEW_REQUIRED" · "FULFILLMENT_STATE_CONFLICT" · "FULFILLMENT_VERSION_CONFLICT" · "IDEMPOTENCY_KEY_REUSED" · "INSUFFICIENT_SCOPE" · "INTERNAL_ERROR" · "INVALID_CURSOR" · "INVALID_MEDIA" · "INVALID_REQUEST" · "INVENTORY_UNAVAILABLE" · "INVENTORY_VERSION_CONFLICT" · "LISTING_CONFLICT" · "MARKETPLACE_NOT_ACTIVE" · "MEDIA_QUOTA_EXCEEDED" · "MEDIA_TOO_LARGE" · "OBSERVATION_STALE" · "ON_HAND_BELOW_RESERVED" · "PRODUCT_REVISION_CONFLICT" · "PRODUCT_SLUG_CONFLICT" · "PRODUCT_STATE_CONFLICT" · "RATE_LIMITED" · "RESERVATION_CONFLICT" · "RESERVATION_EXPIRED" · "RESERVATION_MANAGED_BY_EXTERNAL_ORDER" · "RESOURCE_NOT_FOUND" · "SERVICE_UNAVAILABLE" · "SOURCE_MEDIA_NOT_READY" · "SOURCE_MEDIA_SNAPSHOT_CHANGED" · "STOCK_CLAIM_EXPIRED" · "STOCK_EFFECT_BUSY" · "STOCK_EFFECT_CONFLICT" · "STOCK_EFFECT_VERSION_CONFLICT" · "STOCK_RECONCILIATION_REQUIRED" · "STOCK_SOURCE_BUSY" · "UNAUTHENTICATED"
- Valores permitidos
-
string
-
string
-
Present only on INVALID_REQUEST when Moku can locate the violation; it currently carries the first violation found. Clients that read only code and detail can ignore it.
- Elementos mínimos
1 - Elementos máximos
20
Ver campos de cada elemento · object
- Esta regla no permite propiedades adicionales.
-
RFC 6901 JSON Pointer to the violation. It is relative to the JSON request body for body errors (/variations/0/price) and to the query parameters as an object for query errors (/limit). For a publish transition it locates the field in the product as GET returns it (/image_urls). An empty pointer means the whole body.
- Caracteres máximos
512
- Caracteres máximos
-
required: missing or empty. type: wrong JSON type. range: number outside its bounds. length: too long or too many items. format: malformed string. enum: unsupported value. unknown_field: field not accepted here. duplicate: repeats an earlier item. relation: conflicts with another field or with the current product. media: not an image this store uploaded through PUT /media/{sha256}.
- Valores permitidos
"required" · "type" · "range" · "length" · "format" · "enum" · "unknown_field" · "duplicate" · "relation" · "media"
- Valores permitidos
-
string
- Elementos mínimos
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