Learn about CoCart’s core standards for the REST API
/v{major}
. For example, /cocart/v2/cart
.
The current supported WordPress REST API integration for CoCart is version v2
.
cocart/v2
namespace, and since this API extends the WordPress API, accessing it requires the /wp-json/
base.
Examples:
CoCart-Version
if you have WP_DEBUG
enabled which will be set to the current version of the plugin you are using.v2
. If breaking changes are necessary that changes the data in the response, we’ll release a new major version. We may deprecate APIs that have been replaced by a newer version.
When doing so, we will expect developers to manage a transition to the new resources within the deprecation timeline of old ones.
Changes we do not consider to be breaking:
Parameter | Description |
---|---|
page | Current page of the collection. Defaults to 1. |
per_page | Maximum number of items to be returned in result set. Defaults to 10. Maximum 100. |
per_page
is capped at 100 records. If you wish to retrieve more than 100 records, for example to build a client-side list of all available categories, you may make multiple API requests and combine the results within your application.Header | Description |
---|---|
X-WP-Total | The total number of items in the collection. |
X-WP-TotalPages | The total number of pages in the collection. |
Link | Contains links to other pages; next, prev, and up where applicable. |
Request type | Description |
---|---|
GET | Access one or more resources and return 200 OK and the result as JSON. |
POST | Return 201 Created if the resource is successfully created and return the newly created resource as JSON. |
PUT | Return 200 OK if the resource is modified successfully. The modified result is returned as JSON. |
DELETE | Returns 204 No Content if the resource was deleted successfully. |
Status Code | Description |
---|---|
200 OK | The request was successful, the resource(s) itself is returned as JSON. |
201 Created | The POST request was successful and the resource is returned as JSON. |
204 No Content | The server has successfully fulfilled the request and that there is no additional content to send in the response payload body. |
400 Bad Request | A required attribute of the API request is missing. |
401 Unauthorized | Authentication or permission error, e.g. incorrect login. |
403 Forbidden | Not allowed to process this action or have permission. |
404 Not Found | A resource could not be accessed, for example it doesn’t exist. |
405 Method Not Allowed | A request method is not supported for the requested resource. |
406 Not Acceptable | Indicates that the server could not produce a response. |
500 Internal Server Error | While handling the request something went wrong server-side. |
GET
requests to read product, cart, or checkout data.POST
and PUT
requests to update cart and checkout data.DELETE
requests to remove cart data.OPTIONS
requests to retrieve the JSON schema for the current route.POST
, PUT
and DELETE
), but if not you can use the _method
property.
2025-03-22T11:56:48.520641Z
.
GB
and US
.
USD
or EUR
. The value of a currency is represented by your WooCommerce store settings on the General tab.
Most currencies have a “precision” of two (like USD: $1.23).
AED
, VEF
, PKR
, IDR
, HKD
, QAR
, PHP
, NZD
, INR
, EUR
, ARS
, THB
, MXN
, EGP
, DZD
, SAR
, LBP
, COP
, TRY
, SGD
, MAD
, AUD
, USD
, MYR
, CAD
, BRL
, GBP
.VND
, KRW
, CLP
, JPY
KWD
, IQD
, BHD
, TND