Errors
Two formats
Plugin errors. Returned by the resource itself: nonexistent product, invalid data, conflict…
{
"success": false,
"error": {
"code": "notiwoo_extra_not_found",
"message": "Extra not found.",
"details": {}
}
}
details can contain additional data, for example the field or index that failed. It can also be empty ({} or []).
WordPress errors. Raised before the request reaches the resource: missing authentication or permissions, missing or invalid required parameters, nonexistent routes.
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): entity, operation, target, request_id",
"data": { "status": 400, "params": ["entity", "operation", "target", "request_id"] }
}
Your client must handle both. A simple way:
const body = await response.json();
const code = body.error?.code ?? body.code; // plugin or WordPress
const message = body.error?.message ?? body.message;
Always decide based on code and the HTTP status, never on message: the text changes with the site language.
Common codes
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
notiwoo_unauthorized | 401 | Authentication is missing or the token is not valid. | Request a new token. |
notiwoo_forbidden | 403 | The user does not have permission. | Use an administrator or shop manager account. |
rest_forbidden | 401/403 | Same as above, on the per-mode shutdown route. | Same as above. |
notiwoo_invalid_credentials | 401 | Wrong username or password when requesting the token. | Check the credentials. |
rest_missing_callback_param | 400 | A required parameter is missing. | Check data.params. |
rest_invalid_param | 400 | A parameter has an invalid type or value. | Check data.params. |
rest_no_route | 404 | The route or method does not exist. | Check the route and the HTTP method. |
notiwoo_not_found | 404 | Product or category does not exist or is not published. | — |
notiwoo_woocommerce_missing | 500 | WooCommerce is not active. | Activate WooCommerce. |
notiwoo_cutover_pending | 409 | Coexistence mode: the store does not accept orders through the API. | Finish the migration. |
notiwoo_deprecated_route | 308 | Old woofood/* route. | Use the route in details.redirect_to. |
Conflicts (409)
A 409 means the operation conflicts with the current state. For example:
notiwoo_bulk_busy: a bulk change is already in progress.table_busyortable_occupied: the table is occupied or locked.loyalty_unavailable: the program is disabled, the account is locked by another operation, or WhatsApp is not configured.notiwoo_product_changed: the product changed while the order was being created.
Read the resource again, fix the problem and retry. If the operation uses an idempotency key, retry with the same key.
Errors inside a successful response
Some validations respond 200 and return problems as data, so you can show them to the customer:
POST /cart/validate:data.validanddata.errors[].POST /delivery/check-address:data.deliverableanddata.reason.POST /users/me/addresses:data.deliverable: falseif there is no coverage.
Each resource page lists its specific codes.