Introduction
WooCommerce Bookings is fully integrated with the WordPress REST API. This allows Bookings data to be read using requests in JSON format and using WordPress REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
The current WP REST API integration version is v1
which takes a first-order position in endpoints.
Requirements
To use the Bookings REST API you must be using:
- WooCommerce 3.5+.
- WooCommerce Bookings 1.14.0+.
- WordPress 4.4+.
- Pretty permalinks in
Settings > Permalinks
so that the custom endpoints are supported. Default permalinks will not work. - You may access the API over either HTTP or HTTPS, but HTTPS is recommended where possible.
If you use ModSecurity and see 501 Method Not Implemented
errors, see this issue for details.
Request/Response Format
The default response format is JSON. Requests with a message-body use plain JSON to set or update resource attributes. Successful requests will return a 200 OK
HTTP status.
Some general information about responses:
- Dates are returned in ISO8601 format:
YYYY-MM-DDTHH:MM:SS
- Resource IDs are returned as integers.
- Any decimal monetary amount, such as prices or totals, will be returned as strings with two decimal places.
- Other amounts, such as item counts, are returned as integers.
- Blank fields are generally included as
null
or emtpy string instead of being omitted.
JSONP Support
The WP REST API supports JSONP by default. JSONP responses use the application/javascript
content-type. You can specify the callback using the ?_jsonp
parameter for GET
requests to have the response wrapped in a JSON function:
/wp-json/wc-bookings/v1?_jsonp=callback
curl https://example.com/wp-json/wc-bookings/v1/products/tags/34?_jsonp=tagDetails \
-u consumer_key:consumer_secret
WooCommerce.get("products/tags/34?_jsonp=tagDetails")
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.log(error.response.data);
});
<?php print_r($woocommerce->get('products/tags/34', ['_jsonp' => 'tagDetails'])); ?>
print(wcapi.get("products/tags/34?_jsonp=tagDetails").json())
woocommerce.get("products/tags/34", _jsonp: "tagDetails").parsed_response
Response:
/**/tagDetails({"id":34,"name":"Leather Shoes","slug":"leather-shoes","description":"","count":0,"_links":{"self":[{"href":"https://example.com/wp-json/wc-bookings/v1/products/tags/34"}],"collection":[{"href":"https://example.com/wp-json/wc-bookings/v1/products/tags"}]}})%
Errors
Occasionally you might encounter errors when accessing the REST API. There are four possible types:
Error Code | Error Type |
---|---|
400 Bad Request |
Invalid request, e.g. using an unsupported HTTP method |
401 Unauthorized |
Authentication or permission error, e.g. incorrect API keys |
404 Not Found |
Requests to resources that don't exist or are missing |
500 Internal Server Error |
Server error |
WP REST API error example:
{
"code": "rest_no_route",
"message": "No route was found matching the URL and request method",
"data": {
"status": 404
}
}
WooCommerce REST API error example:
{
"code": "woocommerce_rest_term_invalid",
"message": "Resource doesn't exist.",
"data": {
"status": 404
}
}
Errors return both an appropriate HTTP status code and response object which contains a code
, message
and data
attribute.
Parameters
Almost all endpoints accept optional parameters which can be passed as a HTTP query string parameter, e.g. GET /bookings?status=completed
. All parameters are documented along each endpoint.
Pagination
Requests that return multiple items will be paginated to 10 items by default. This default can be changed by the site administrator by changing the posts_per_page
option. Alternatively the items per page can be specified with the ?per_page
parameter:
GET /bookings?per_page=15
You can specify further pages with the ?page
parameter:
GET /bookings?page=2
You may also specify the offset from the first resource using the ?offset
parameter:
GET /bookings?offset=5
Page number is 1-based and omitting the ?page
parameter will return the first page.
The total number of resources and pages are always included in the X-WP-Total
and X-WP-TotalPages
HTTP headers.
Link Header
Pagination info is included in the Link Header. It's recommended that you follow these values instead of building your own URLs where possible.
Link: <https://www.example.com/wp-json/wc-bookings/v1/products?page=2>; rel="next",
<https://www.example.com/wp-json/wc-bookings/v1/products?page=3>; rel="last"`
The possible rel
values are:
Value | Description |
---|---|
next |
Shows the URL of the immediate next page of results. |
last |
Shows the URL of the last page of results. |
first |
Shows the URL of the first page of results. |
prev |
Shows the URL of the immediate previous page of results. |
Tools
Useful Tools
Some useful tools you can use to access the API include:
- Insomnia - Cross-platform GraphQL and REST client, available for Mac, Windows, and Linux.
- Postman - Cross-platform REST client, available for Mac, Windows, and Linux.
- RequestBin - Allows you test webhooks.
- Hookbin - Another tool to test webhooks.
Learn more
Learn more about the REST API checking the official WordPress REST API documentation.
Authentication
WooCommerce includes two ways to authenticate with the WP REST API. It is also possible to authenticate using any WP REST API authentication plugin or method.
REST API keys
Pre-generated keys can be used to authenticate use of the REST API endpoints. New keys can be generated either through the WordPress admin interface or they can be auto-generated through an endpoint.
Generating API keys in the WordPress admin interface
To create or manage keys for a specific WordPress user, go to WooCommerce > Settings > API > Keys/Apps.
Click the "Add Key" button. In the next screen, add a description and select the WordPress user you would like to generate the key for. Use of the REST API with the generated keys will conform to that user's WordPress roles and capabilities.
Choose the level of access for this REST API key, which can be Read access, Write access or Read/Write access. Then click the "Generate API Key" button and WooCommerce will generate REST API keys for the selected user.
Now that keys have been generated, you should see two new keys, a QRCode, and a Revoke API Key button. These two keys are your Consumer Key and Consumer Secret.
If the WordPress user associated with an API key is deleted, the API key will cease to function. API keys are not transferred to other users.
Auto generating API keys using our Application Authentication Endpoint
This endpoint can be used by any APP to allow users to generate API keys for your APP. This makes integration with WooCommerce API easier because the user only needs to grant access to your APP via a URL. After being redirected back to your APP, the API keys will be sent back in a separate POST request.
The following image illustrates how this works:
URL parameters
Parameter | Type | Description |
---|---|---|
app_name |
string | Your APP name mandatory |
scope |
string | Level of access. Available: read , write and read_write mandatory |
user_id |
string | User ID in your APP. For your internal reference, used when the user is redirected back to your APP. NOT THE USER ID IN WOOCOMMERCE mandatory |
return_url |
string | URL the user will be redirected to after authentication mandatory |
callback_url |
string | URL that will receive the generated API key. Note: this URL should be over HTTPS mandatory |
Creating an authentication endpoint URL
You must use the /wc-auth/v1/authorize
endpoint and pass the above parameters as a query string.
Example of how to build an authentication URL:
# Bash example
STORE_URL='http://example.com'
ENDPOINT='/wc-auth/v1/authorize'
PARAMS="app_name=My App Name&scope=read_write&user_id=123&return_url=http://app.com/return-page&callback_url=https://app.com/callback-endpoint"
QUERY_STRING="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$PARAMS")"
QUERY_STRING=$(echo $QUERY_STRING | sed -e "s/%20/\+/g" -e "s/%3D/\=/g" -e "s/%26/\&/g")
echo "$STORE_URL$ENDPOINT?$QUERY_STRING"
const querystring = require('querystring');
const store_url = 'http://example.com';
const endpoint = '/wc-auth/v1/authorize';
const params = {
app_name: 'My App Name',
scope: 'read_write',
user_id: 123,
return_url: 'http://app.com/return-page',
callback_url: 'https://app.com/callback-endpoint'
};
const query_string = querystring.stringify(params).replace(/%20/g, '+');
console.log(store_url + endpoint + '?' + query_string);
<?php
$store_url = 'http://example.com';
$endpoint = '/wc-auth/v1/authorize';
$params = [
'app_name' => 'My App Name',
'scope' => 'write',
'user_id' => 123,
'return_url' => 'http://app.com',
'callback_url' => 'https://app.com'
];
$query_string = http_build_query( $params );
echo $store_url . $endpoint . '?' . $query_string;
?>
from urllib.parse import urlencode
store_url = 'http://example.com'
endpoint = '/wc-auth/v1/authorize'
params = {
"app_name": "My App Name",
"scope": "read_write",
"user_id": 123,
"return_url": "http://app.com/return-page",
"callback_url": "https://app.com/callback-endpoint"
}
query_string = urlencode(params)
print("%s%s?%s" % (store_url, endpoint, query_string))
require "uri"
store_url = 'http://example.com'
endpoint = '/wc-auth/v1/authorize'
params = {
app_name: "My App Name",
scope: "read_write",
user_id: 123,
return_url: "http://app.com/return-page",
callback_url: "https://app.com/callback-endpoint"
}
query_string = URI.encode_www_form(params)
puts "#{store_url}#{endpoint}?#{query_string}"
Example of JSON posted with the API Keys
{
"key_id": 1,
"user_id": 123,
"consumer_key": "ck_xxxxxxxxxxxxxxxx",
"consumer_secret": "cs_xxxxxxxxxxxxxxxx",
"key_permissions": "read_write"
}
Example of the screen that the user will see:
Notes
- While redirecting the user using
return_url
, you are also sentsuccess
anduser_id
parameters as query strings. success
sends0
if the user denied, or1
if authenticated successfully.- Use
user_id
to identify the user when redirected back to the (return_url
) and also remember to save the API Keys when yourcallback_url
is posted to after auth. - The auth endpoint will send the API Keys in JSON format to the
callback_url
, so it's important to remember that some languages such as PHP will not display it inside the$_POST
global variable, in PHP you can access it using$HTTP_RAW_POST_DATA
(for old PHP versions) orfile_get_contents('php://input');
. - The URL generated must have all query string values encoded.
Authentication over HTTPS
You may use HTTP Basic Auth by providing the REST API Consumer Key as the username and the REST API Consumer Secret as the password.
HTTP Basic Auth example
curl https://www.example.com/wp-json/wc-bookings/v1/orders \
-u consumer_key:consumer_secret
const WooCommerceRestApi = require("@woocommerce/woocommerce-rest-api").default;
// import WooCommerceRestApi from "@woocommerce/woocommerce-rest-api"; // Supports ESM
const WooCommerce = new WooCommerceRestApi({
url: 'https://example.com',
consumerKey: 'consumer_key',
consumerSecret: 'consumer_secret',
version: 'wc-bookings/v1'
});
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
$woocommerce = new Client(
'https://example.com',
'consumer_key',
'consumer_secret',
[
'wp_api' => true,
'version' => 'wc-bookings/v1'
]
);
?>
from woocommerce import API
wcapi = API(
url="https://example.com",
consumer_key="consumer_key",
consumer_secret="consumer_secret",
wp_api=True,
version="wc-bookings/v1"
)
require "woocommerce_api"
woocommerce = WooCommerce::API.new(
"https://example.com",
"consumer_key",
"consumer_secret",
{
wp_json: true,
version: "wc-bookings/v1"
}
)
Occasionally some servers may not parse the Authorization header correctly (if you see a "Consumer key is missing" error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters instead.
Example for servers that not properly parse the Authorization header:
curl https://www.example.com/wp-json/wc-bookings/v1/orders?consumer_key=123&consumer_secret=abc
const WooCommerceRestApi = require("@woocommerce/woocommerce-rest-api").default;
// import WooCommerceRestApi from "@woocommerce/woocommerce-rest-api"; // Supports ESM
const WooCommerce = new WooCommerceRestApi({
url: 'https://example.com',
consumerKey: 'consumer_key',
consumerSecret: 'consumer_secret',
version: 'wc-bookings/v1',
queryStringAuth: true // Force Basic Authentication as query string true and using under HTTPS
});
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
$woocommerce = new Client(
'https://example.com',
'consumer_key',
'consumer_secret',
[
'wp_api' => true,
'version' => 'wc-bookings/v1',
'query_string_auth' => true // Force Basic Authentication as query string true and using under HTTPS
]
);
?>
from woocommerce import API
wcapi = API(
url="https://example.com",
consumer_key="consumer_key",
consumer_secret="consumer_secret",
wp_api=True,
version="wc-bookings/v1",
query_string_auth=True // Force Basic Authentication as query string true and using under HTTPS
)
require "woocommerce_api"
woocommerce = WooCommerce::API.new(
"https://example.com",
"consumer_key",
"consumer_secret",
{
wp_json: true,
version: "wc-bookings/v1",
query_string_auth: true // Force Basic Authentication as query string true and using under HTTPS
}
)
Authentication over HTTP
You must use OAuth 1.0a "one-legged" authentication to ensure REST API credentials cannot be intercepted by an attacker. Typically you will use any standard OAuth 1.0a library in the language of your choice to handle the authentication, or generate the necessary parameters by following the following instructions.
Creating a signature
Collect the request method and URL
First you need to determine the HTTP method you will be using for the request, and the URL of the request.
The HTTP method will be GET
in our case.
The Request URL will be the endpoint you are posting to, e.g. http://www.example.com/wp-json/wc-bookings/v1/orders
.
Collect parameters
Collect and normalize your parameters. This includes all oauth_*
parameters except for the oauth_signature
itself.
These values need to be encoded into a single string which will be used later on. The process to build the string is very specific:
- Percent encode every key and value that will be signed.
- Sort the list of parameters alphabetically by encoded key.
- For each key/value pair:
- Append the encoded key to the output string.
- Append the
=
character to the output string. - Append the encoded value to the output string.
- If there are more key/value pairs remaining, append a
&
character to the output string.
When percent encoding in PHP for example, you would use rawurlencode()
.
When sorting parameters in PHP for example, you would use uksort( $params, 'strcmp' )
.
Parameters example:
oauth_consumer_key=abc123&oauth_signature_method=HMAC-SHA1
Create the signature base string
The above values collected so far must be joined to make a single string, from which the signature will be generated. This is called the signature base string in the OAuth specification.
To encode the HTTP method, request URL, and parameter string into a single string:
- Set the output string equal to the uppercase HTTP Method.
- Append the
&
character to the output string. - Percent encode the URL and append it to the output string.
- Append the
&
character to the output string. - Percent encode the parameter string and append it to the output string.
Example signature base string:
GET&http%3A%2F%2Fwww.example.com%2Fwp-json%2Fwc%2Fv3%2Forders&oauth_consumer_key%3Dabc123%26oauth_signature_method%3DHMAC-SHA1
Generate the signature
Generate the signature using the signature base string and your consumer secret key with a &
character with the HMAC-SHA1 hashing algorithm.
In PHP you can use the hash_hmac function.
HMAC-SHA1 or HMAC-SHA256 are the only accepted hash algorithms.
If you are having trouble generating a correct signature, you'll want to review the string you are signing for encoding errors. The authentication source can also be helpful in understanding how to properly generate the signature.
OAuth tips
- The OAuth parameters may be added as query string parameters or included in the Authorization header.
- Note there is no reliable cross-platform way to get the raw request headers in WordPress, so query string should be more reliable in some cases.
- The required parameters are:
oauth_consumer_key
,oauth_timestamp
,oauth_nonce
,oauth_signature
, andoauth_signature_method
.oauth_version
is not required and should be omitted. - The OAuth nonce can be any randomly generated 32 character (recommended) string that is unique to the consumer key. Read more suggestions on generating nonces on the Twitter REST API forums.
- The OAuth timestamp should be the unix timestamp at the time of the request. The REST API will deny any requests that include a timestamp outside of a 15 minute window to prevent replay attacks.
- You must use the store URL provided by the index when forming the base string used for the signature, as this is what the server will use. (e.g. if the store URL includes a
www
sub-domain, you should use it for requests) - You may test your generated signature using LinkedIn's OAuth test console -- leave the member token/secret blank.
- Twitter has great instructions on generating signatures with OAuth 1.0a, but remember tokens are not used with this implementation.
- Note that the request body is not signed as per the OAuth spec, see Google's OAuth 1.0 extension for details on why.
- If including parameters in your request, it saves a lot of trouble if you can order your items alphabetically.
- Authorization header is supported starting WooCommerce 3.0.
Index
By default, the API provides information about all available endpoints on the site. Authentication is not required to access the API index.
HTTP request
/wp-json/wc-bookings/v1
curl https://example.com/wp-json/wc-bookings/v1
JSON response example:
{
"namespace": "wc-bookings/v1",
"routes": {
"/wc-bookings/v1": {
"namespace": "wc-bookings/v1",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"namespace": {
"required": false,
"default": "wc-bookings/v1"
},
"context": {
"required": false,
"default": "view"
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1"
}
},
"/wc-bookings/v1/products": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"default": "view",
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
},
"page": {
"required": false,
"default": 1,
"description": "Current page of the collection.",
"type": "integer"
},
"per_page": {
"required": false,
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"type": "integer"
},
"search": {
"required": false,
"description": "Limit results to those matching a string.",
"type": "string"
},
"after": {
"required": false,
"description": "Limit response to resources published after a given ISO8601 compliant date.",
"type": "string"
},
"before": {
"required": false,
"description": "Limit response to resources published before a given ISO8601 compliant date.",
"type": "string"
},
"exclude": {
"required": false,
"default": [],
"description": "Ensure result set excludes specific IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"include": {
"required": false,
"default": [],
"description": "Limit result set to specific ids.",
"type": "array",
"items": {
"type": "integer"
}
},
"offset": {
"required": false,
"description": "Offset the result set by a specific number of items.",
"type": "integer"
},
"order": {
"required": false,
"default": "desc",
"enum": [
"asc",
"desc"
],
"description": "Order sort attribute ascending or descending.",
"type": "string"
},
"orderby": {
"required": false,
"default": "date",
"enum": [
"date",
"id",
"include",
"title",
"slug",
"menu_order",
"price",
"popularity",
"rating"
],
"description": "Sort collection by object attribute.",
"type": "string"
},
"parent": {
"required": false,
"default": [],
"description": "Limit result set to those of particular parent IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"parent_exclude": {
"required": false,
"default": [],
"description": "Limit result set to all items except those of a particular parent ID.",
"type": "array",
"items": {
"type": "integer"
}
},
"slug": {
"required": false,
"description": "Limit result set to products with a specific slug.",
"type": "string"
},
"status": {
"required": false,
"default": "publish",
"enum": [
"any",
"future",
"draft",
"pending",
"private",
"publish"
],
"description": "Limit result set to products assigned a specific status.",
"type": "string"
},
"type": {
"required": false,
"default": "booking",
"enum": [
"booking"
],
"description": "Limit result set to products assigned a specific type.",
"type": "string"
},
"sku": {
"required": false,
"description": "Limit result set to products with specific SKU(s). Use commas to separate.",
"type": "string"
},
"featured": {
"required": false,
"description": "Limit result set to featured products.",
"type": "boolean"
},
"category": {
"required": false,
"description": "Limit result set to products assigned a specific category ID.",
"type": "string"
},
"tag": {
"required": false,
"description": "Limit result set to products assigned a specific tag ID.",
"type": "string"
},
"shipping_class": {
"required": false,
"description": "Limit result set to products assigned a specific shipping class ID.",
"type": "string"
},
"attribute": {
"required": false,
"description": "Limit result set to products with a specific attribute. Use the taxonomy name/attribute slug.",
"type": "string"
},
"attribute_term": {
"required": false,
"description": "Limit result set to products with a specific attribute term ID (required an assigned attribute).",
"type": "string"
},
"tax_class": {
"required": false,
"enum": [
"standard",
"reduced-rate",
"zero-rate"
],
"description": "Limit result set to products with a specific tax class.",
"type": "string"
},
"on_sale": {
"required": false,
"description": "Limit result set to products on sale.",
"type": "boolean"
},
"min_price": {
"required": false,
"description": "Limit result set to products based on a minimum price.",
"type": "string"
},
"max_price": {
"required": false,
"description": "Limit result set to products based on a maximum price.",
"type": "string"
},
"stock_status": {
"required": false,
"enum": [
"instock",
"outofstock",
"onbackorder"
],
"description": "Limit result set to products with specified stock status.",
"type": "string"
},
"resource": {
"required": false,
"description": "Limit result set to products assigned a specific resource ID.",
"type": "array",
"items": {
"type": "integer"
}
}
}
},
{
"methods": [
"POST"
],
"args": {
"name": {
"required": false,
"description": "Product name.",
"type": "string"
},
"slug": {
"required": false,
"description": "Product slug.",
"type": "string"
},
"date_created": {
"required": false,
"description": "The date the product was created, in the site's timezone.",
"type": "date-time"
},
"date_created_gmt": {
"required": false,
"description": "The date the product was created, as GMT.",
"type": "date-time"
},
"type": {
"required": false,
"default": "simple",
"enum": [
"simple",
"grouped",
"external",
"variable"
],
"description": "Product type.",
"type": "string"
},
"status": {
"required": false,
"default": "publish",
"enum": [
"draft",
"pending",
"private",
"publish",
"future"
],
"description": "Product status (post status).",
"type": "string"
},
"featured": {
"required": false,
"default": false,
"description": "Featured product.",
"type": "boolean"
},
"catalog_visibility": {
"required": false,
"default": "visible",
"enum": [
"visible",
"catalog",
"search",
"hidden"
],
"description": "Catalog visibility.",
"type": "string"
},
"description": {
"required": false,
"description": "Product description.",
"type": "string"
},
"short_description": {
"required": false,
"description": "Product short description.",
"type": "string"
},
"sku": {
"required": false,
"description": "Unique identifier.",
"type": "string"
},
"regular_price": {
"required": false,
"description": "Product regular price.",
"type": "string"
},
"sale_price": {
"required": false,
"description": "Product sale price.",
"type": "string"
},
"date_on_sale_from": {
"required": false,
"description": "Start date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_from_gmt": {
"required": false,
"description": "Start date of sale price, as GMT.",
"type": "date-time"
},
"date_on_sale_to": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_to_gmt": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"virtual": {
"required": false,
"default": false,
"description": "If the product is virtual.",
"type": "boolean"
},
"downloadable": {
"required": false,
"default": false,
"description": "If the product is downloadable.",
"type": "boolean"
},
"downloads": {
"required": false,
"description": "List of downloadable files.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "File ID.",
"type": "string",
"context": [
"view",
"edit"
]
},
"name": {
"description": "File name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"file": {
"description": "File URL.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"download_limit": {
"required": false,
"default": -1,
"description": "Number of times downloadable files can be downloaded after purchase.",
"type": "integer"
},
"download_expiry": {
"required": false,
"default": -1,
"description": "Number of days until access to downloadable files expires.",
"type": "integer"
},
"external_url": {
"required": false,
"description": "Product external URL. Only for external products.",
"type": "string"
},
"button_text": {
"required": false,
"description": "Product external button text. Only for external products.",
"type": "string"
},
"tax_status": {
"required": false,
"default": "taxable",
"enum": [
"taxable",
"shipping",
"none"
],
"description": "Tax status.",
"type": "string"
},
"tax_class": {
"required": false,
"description": "Tax class.",
"type": "string"
},
"manage_stock": {
"required": false,
"default": false,
"description": "Stock management at product level.",
"type": "boolean"
},
"stock_quantity": {
"required": false,
"description": "Stock quantity.",
"type": "integer"
},
"stock_status": {
"required": false,
"default": "instock",
"enum": [
"instock",
"outofstock",
"onbackorder"
],
"description": "Controls the stock status of the product.",
"type": "string"
},
"backorders": {
"required": false,
"default": "no",
"enum": [
"no",
"notify",
"yes"
],
"description": "If managing stock, this controls if backorders are allowed.",
"type": "string"
},
"sold_individually": {
"required": false,
"default": false,
"description": "Allow one item to be bought in a single order.",
"type": "boolean"
},
"weight": {
"required": false,
"description": "Product weight (oz).",
"type": "string"
},
"dimensions": {
"required": false,
"description": "Product dimensions.",
"type": "object"
},
"shipping_class": {
"required": false,
"description": "Shipping class slug.",
"type": "string"
},
"reviews_allowed": {
"required": false,
"default": true,
"description": "Allow reviews.",
"type": "boolean"
},
"upsell_ids": {
"required": false,
"description": "List of up-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"cross_sell_ids": {
"required": false,
"description": "List of cross-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"parent_id": {
"required": false,
"description": "Product parent ID.",
"type": "integer"
},
"purchase_note": {
"required": false,
"description": "Optional note to send the customer after purchase.",
"type": "string"
},
"categories": {
"required": false,
"description": "List of categories.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Category ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Category name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Category slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"tags": {
"required": false,
"description": "List of tags.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Tag ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Tag name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Tag slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"images": {
"required": false,
"description": "List of images.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Image ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"date_created": {
"description": "The date the image was created, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_created_gmt": {
"description": "The date the image was created, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified": {
"description": "The date the image was last modified, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified_gmt": {
"description": "The date the image was last modified, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"src": {
"description": "Image URL.",
"type": "string",
"format": "uri",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Image name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"alt": {
"description": "Image alternative text.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"attributes": {
"required": false,
"description": "List of attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"position": {
"description": "Attribute position.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"visible": {
"description": "Define if the attribute is visible on the \"Additional information\" tab in the product's page.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"variation": {
"description": "Define if the attribute can be used as variation.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"options": {
"description": "List of available term names of the attribute.",
"type": "array",
"items": {
"type": "string"
},
"context": [
"view",
"edit"
]
}
}
}
},
"default_attributes": {
"required": false,
"description": "Defaults variation attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"option": {
"description": "Selected attribute term name.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort products.",
"type": "integer"
},
"meta_data": {
"required": false,
"description": "Meta data.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Meta ID.",
"type": "integer",
"context": [
"view",
"edit"
],
"readonly": true
},
"key": {
"description": "Meta key.",
"type": "string",
"context": [
"view",
"edit"
]
},
"value": {
"description": "Meta value.",
"type": "mixed",
"context": [
"view",
"edit"
]
}
}
}
},
"apply_adjacent_buffer": {
"required": false,
"description": "Apply adjacent buffers.",
"type": "boolean"
},
"availability": {
"required": false,
"description": "Availability rules defined on product level.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Availability type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"bookable": {
"description": "Rule marks things as bookable or not, 'yes' or 'no'.",
"type": "string",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"block_cost": {
"required": false,
"description": "Base cost of each block.",
"type": "number"
},
"buffer_period": {
"required": false,
"description": "Required buffer Period between bookings.",
"type": "integer"
},
"calendar_display_mode": {
"required": false,
"enum": [
"",
"always_visible"
],
"description": "How the calendar will display on the product page. Valid values are 'always_visible' or ''.",
"type": "string"
},
"cancel_limit_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "The unit limit is defined in. Valid values are 'month', 'day', 'hour', and 'minute'.",
"type": "string"
},
"cancel_limit": {
"required": false,
"description": "How many limit units in advance users are allowed to cancel bookings.",
"type": "integer"
},
"check_start_block_only": {
"required": false,
"description": "If true only the first block in checked for availability.",
"type": "boolean"
},
"cost": {
"required": false,
"description": "Product cost.",
"type": "number"
},
"default_date_availability": {
"required": false,
"enum": [
"",
"available"
],
"description": "If 'available' product is bookable unless made unbookable by availability rules.",
"type": "string"
},
"display_cost": {
"required": false,
"description": "Product cost displayed.",
"type": "string"
},
"duration_type": {
"required": false,
"enum": [
"customer",
"fixed"
],
"description": "How duration is defined.",
"type": "string"
},
"duration_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "Unit duration is defined in.",
"type": "string"
},
"duration": {
"required": false,
"description": "Size in duration units of each block.",
"type": "integer"
},
"enable_range_picker": {
"required": false,
"description": "Customer can pick a range of days on calendar.",
"type": "boolean"
},
"first_block_time": {
"required": false,
"description": "Time of day first block starts.",
"type": "string"
},
"has_person_cost_multiplier": {
"required": false,
"description": "Will multiply cost by number of persons.",
"type": "boolean"
},
"has_person_qty_multiplier": {
"required": false,
"description": "Each person counts as a booking.",
"type": "boolean"
},
"has_person_types": {
"required": false,
"description": "Product has different types of persons.",
"type": "boolean"
},
"has_persons": {
"required": false,
"description": "Product has persons defined.",
"type": "boolean"
},
"has_resources": {
"required": false,
"description": "Product has resources defined.",
"type": "boolean"
},
"has_restricted_days": {
"required": false,
"description": "Product has restricted days.",
"type": "boolean"
},
"max_date": {
"required": false,
"description": "Max date value combined with max date unit.",
"type": "string"
},
"max_date_value": {
"required": false,
"description": "Max amount af max_date_units into the future a block is bookable.",
"type": "integer"
},
"max_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for max_date_value.",
"type": "string"
},
"min_date": {
"required": false,
"description": "Min date value combined with min date unit.",
"type": "string"
},
"min_date_value": {
"required": false,
"description": "Min amount af min_date_units into the future a block is bookable.",
"type": "integer"
},
"min_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for min_date_value.",
"type": "string"
},
"max_duration": {
"required": false,
"description": "Max duration of units a booking can be.",
"type": "integer"
},
"min_duration": {
"required": false,
"description": "Min duration of units a booking can be.",
"type": "integer"
},
"max_persons": {
"required": false,
"description": "Max persons which can be booked per booking.",
"type": "integer"
},
"min_persons": {
"required": false,
"description": "Min persons which can be booked per booking.",
"type": "integer"
},
"pricing": {
"required": false,
"description": "Pricing rules.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Date range type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"modifier": {
"description": "How the block cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"cost": {
"description": "Block cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"base_modifier": {
"description": "How the base cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"base_cost": {
"description": "Base cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"qty": {
"required": false,
"description": "Max bookings per block.",
"type": "integer"
},
"requires_confirmation": {
"required": false,
"description": "Booking require confirmation.",
"type": "boolean"
},
"restricted_days": {
"required": false,
"description": "Days days of week bookings cannot start. Array of numeric day indexes with 0 being Sunday.",
"type": "array",
"items": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6
]
}
},
"can_be_cancelled": {
"required": false,
"description": "Booking can be cancelled by customer.",
"type": "boolean"
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/products"
}
},
"/wc-bookings/v1/products/(?P<id>[\\d]+)": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"context": {
"required": false,
"default": "view",
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
}
}
},
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"name": {
"required": false,
"description": "Product name.",
"type": "string"
},
"slug": {
"required": false,
"description": "Product slug.",
"type": "string"
},
"date_created": {
"required": false,
"description": "The date the product was created, in the site's timezone.",
"type": "date-time"
},
"date_created_gmt": {
"required": false,
"description": "The date the product was created, as GMT.",
"type": "date-time"
},
"type": {
"required": false,
"enum": [
"simple",
"grouped",
"external",
"variable"
],
"description": "Product type.",
"type": "string"
},
"status": {
"required": false,
"enum": [
"draft",
"pending",
"private",
"publish",
"future"
],
"description": "Product status (post status).",
"type": "string"
},
"featured": {
"required": false,
"description": "Featured product.",
"type": "boolean"
},
"catalog_visibility": {
"required": false,
"enum": [
"visible",
"catalog",
"search",
"hidden"
],
"description": "Catalog visibility.",
"type": "string"
},
"description": {
"required": false,
"description": "Product description.",
"type": "string"
},
"short_description": {
"required": false,
"description": "Product short description.",
"type": "string"
},
"sku": {
"required": false,
"description": "Unique identifier.",
"type": "string"
},
"regular_price": {
"required": false,
"description": "Product regular price.",
"type": "string"
},
"sale_price": {
"required": false,
"description": "Product sale price.",
"type": "string"
},
"date_on_sale_from": {
"required": false,
"description": "Start date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_from_gmt": {
"required": false,
"description": "Start date of sale price, as GMT.",
"type": "date-time"
},
"date_on_sale_to": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_to_gmt": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"virtual": {
"required": false,
"description": "If the product is virtual.",
"type": "boolean"
},
"downloadable": {
"required": false,
"description": "If the product is downloadable.",
"type": "boolean"
},
"downloads": {
"required": false,
"description": "List of downloadable files.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "File ID.",
"type": "string",
"context": [
"view",
"edit"
]
},
"name": {
"description": "File name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"file": {
"description": "File URL.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"download_limit": {
"required": false,
"description": "Number of times downloadable files can be downloaded after purchase.",
"type": "integer"
},
"download_expiry": {
"required": false,
"description": "Number of days until access to downloadable files expires.",
"type": "integer"
},
"external_url": {
"required": false,
"description": "Product external URL. Only for external products.",
"type": "string"
},
"button_text": {
"required": false,
"description": "Product external button text. Only for external products.",
"type": "string"
},
"tax_status": {
"required": false,
"enum": [
"taxable",
"shipping",
"none"
],
"description": "Tax status.",
"type": "string"
},
"tax_class": {
"required": false,
"description": "Tax class.",
"type": "string"
},
"manage_stock": {
"required": false,
"description": "Stock management at product level.",
"type": "boolean"
},
"stock_quantity": {
"required": false,
"description": "Stock quantity.",
"type": "integer"
},
"stock_status": {
"required": false,
"enum": [
"instock",
"outofstock",
"onbackorder"
],
"description": "Controls the stock status of the product.",
"type": "string"
},
"backorders": {
"required": false,
"enum": [
"no",
"notify",
"yes"
],
"description": "If managing stock, this controls if backorders are allowed.",
"type": "string"
},
"sold_individually": {
"required": false,
"description": "Allow one item to be bought in a single order.",
"type": "boolean"
},
"weight": {
"required": false,
"description": "Product weight (oz).",
"type": "string"
},
"dimensions": {
"required": false,
"description": "Product dimensions.",
"type": "object"
},
"shipping_class": {
"required": false,
"description": "Shipping class slug.",
"type": "string"
},
"reviews_allowed": {
"required": false,
"description": "Allow reviews.",
"type": "boolean"
},
"upsell_ids": {
"required": false,
"description": "List of up-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"cross_sell_ids": {
"required": false,
"description": "List of cross-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"parent_id": {
"required": false,
"description": "Product parent ID.",
"type": "integer"
},
"purchase_note": {
"required": false,
"description": "Optional note to send the customer after purchase.",
"type": "string"
},
"categories": {
"required": false,
"description": "List of categories.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Category ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Category name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Category slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"tags": {
"required": false,
"description": "List of tags.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Tag ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Tag name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Tag slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"images": {
"required": false,
"description": "List of images.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Image ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"date_created": {
"description": "The date the image was created, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_created_gmt": {
"description": "The date the image was created, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified": {
"description": "The date the image was last modified, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified_gmt": {
"description": "The date the image was last modified, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"src": {
"description": "Image URL.",
"type": "string",
"format": "uri",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Image name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"alt": {
"description": "Image alternative text.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"attributes": {
"required": false,
"description": "List of attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"position": {
"description": "Attribute position.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"visible": {
"description": "Define if the attribute is visible on the \"Additional information\" tab in the product's page.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"variation": {
"description": "Define if the attribute can be used as variation.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"options": {
"description": "List of available term names of the attribute.",
"type": "array",
"items": {
"type": "string"
},
"context": [
"view",
"edit"
]
}
}
}
},
"default_attributes": {
"required": false,
"description": "Defaults variation attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"option": {
"description": "Selected attribute term name.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort products.",
"type": "integer"
},
"meta_data": {
"required": false,
"description": "Meta data.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Meta ID.",
"type": "integer",
"context": [
"view",
"edit"
],
"readonly": true
},
"key": {
"description": "Meta key.",
"type": "string",
"context": [
"view",
"edit"
]
},
"value": {
"description": "Meta value.",
"type": "mixed",
"context": [
"view",
"edit"
]
}
}
}
},
"apply_adjacent_buffer": {
"required": false,
"description": "Apply adjacent buffers.",
"type": "boolean"
},
"availability": {
"required": false,
"description": "Availability rules defined on product level.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Availability type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"bookable": {
"description": "Rule marks things as bookable or not, 'yes' or 'no'.",
"type": "string",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"block_cost": {
"required": false,
"description": "Base cost of each block.",
"type": "number"
},
"buffer_period": {
"required": false,
"description": "Required buffer Period between bookings.",
"type": "integer"
},
"calendar_display_mode": {
"required": false,
"enum": [
"",
"always_visible"
],
"description": "How the calendar will display on the product page. Valid values are 'always_visible' or ''.",
"type": "string"
},
"cancel_limit_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "The unit limit is defined in. Valid values are 'month', 'day', 'hour', and 'minute'.",
"type": "string"
},
"cancel_limit": {
"required": false,
"description": "How many limit units in advance users are allowed to cancel bookings.",
"type": "integer"
},
"check_start_block_only": {
"required": false,
"description": "If true only the first block in checked for availability.",
"type": "boolean"
},
"cost": {
"required": false,
"description": "Product cost.",
"type": "number"
},
"default_date_availability": {
"required": false,
"enum": [
"",
"available"
],
"description": "If 'available' product is bookable unless made unbookable by availability rules.",
"type": "string"
},
"display_cost": {
"required": false,
"description": "Product cost displayed.",
"type": "string"
},
"duration_type": {
"required": false,
"enum": [
"customer",
"fixed"
],
"description": "How duration is defined.",
"type": "string"
},
"duration_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "Unit duration is defined in.",
"type": "string"
},
"duration": {
"required": false,
"description": "Size in duration units of each block.",
"type": "integer"
},
"enable_range_picker": {
"required": false,
"description": "Customer can pick a range of days on calendar.",
"type": "boolean"
},
"first_block_time": {
"required": false,
"description": "Time of day first block starts.",
"type": "string"
},
"has_person_cost_multiplier": {
"required": false,
"description": "Will multiply cost by number of persons.",
"type": "boolean"
},
"has_person_qty_multiplier": {
"required": false,
"description": "Each person counts as a booking.",
"type": "boolean"
},
"has_person_types": {
"required": false,
"description": "Product has different types of persons.",
"type": "boolean"
},
"has_persons": {
"required": false,
"description": "Product has persons defined.",
"type": "boolean"
},
"has_resources": {
"required": false,
"description": "Product has resources defined.",
"type": "boolean"
},
"has_restricted_days": {
"required": false,
"description": "Product has restricted days.",
"type": "boolean"
},
"max_date": {
"required": false,
"description": "Max date value combined with max date unit.",
"type": "string"
},
"max_date_value": {
"required": false,
"description": "Max amount af max_date_units into the future a block is bookable.",
"type": "integer"
},
"max_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for max_date_value.",
"type": "string"
},
"min_date": {
"required": false,
"description": "Min date value combined with min date unit.",
"type": "string"
},
"min_date_value": {
"required": false,
"description": "Min amount af min_date_units into the future a block is bookable.",
"type": "integer"
},
"min_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for min_date_value.",
"type": "string"
},
"max_duration": {
"required": false,
"description": "Max duration of units a booking can be.",
"type": "integer"
},
"min_duration": {
"required": false,
"description": "Min duration of units a booking can be.",
"type": "integer"
},
"max_persons": {
"required": false,
"description": "Max persons which can be booked per booking.",
"type": "integer"
},
"min_persons": {
"required": false,
"description": "Min persons which can be booked per booking.",
"type": "integer"
},
"pricing": {
"required": false,
"description": "Pricing rules.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Date range type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"modifier": {
"description": "How the block cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"cost": {
"description": "Block cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"base_modifier": {
"description": "How the base cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"base_cost": {
"description": "Base cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"qty": {
"required": false,
"description": "Max bookings per block.",
"type": "integer"
},
"requires_confirmation": {
"required": false,
"description": "Booking require confirmation.",
"type": "boolean"
},
"restricted_days": {
"required": false,
"description": "Days days of week bookings cannot start. Array of numeric day indexes with 0 being Sunday.",
"type": "array",
"items": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6
]
}
},
"can_be_cancelled": {
"required": false,
"description": "Booking can be cancelled by customer.",
"type": "boolean"
}
}
},
{
"methods": [
"DELETE"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"force": {
"required": false,
"default": false,
"description": "Whether to bypass trash and force deletion.",
"type": "boolean"
}
}
}
]
},
"/wc-bookings/v1/products/batch": {
"namespace": "wc-bookings/v1",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"name": {
"required": false,
"description": "Product name.",
"type": "string"
},
"slug": {
"required": false,
"description": "Product slug.",
"type": "string"
},
"date_created": {
"required": false,
"description": "The date the product was created, in the site's timezone.",
"type": "date-time"
},
"date_created_gmt": {
"required": false,
"description": "The date the product was created, as GMT.",
"type": "date-time"
},
"type": {
"required": false,
"enum": [
"simple",
"grouped",
"external",
"variable"
],
"description": "Product type.",
"type": "string"
},
"status": {
"required": false,
"enum": [
"draft",
"pending",
"private",
"publish",
"future"
],
"description": "Product status (post status).",
"type": "string"
},
"featured": {
"required": false,
"description": "Featured product.",
"type": "boolean"
},
"catalog_visibility": {
"required": false,
"enum": [
"visible",
"catalog",
"search",
"hidden"
],
"description": "Catalog visibility.",
"type": "string"
},
"description": {
"required": false,
"description": "Product description.",
"type": "string"
},
"short_description": {
"required": false,
"description": "Product short description.",
"type": "string"
},
"sku": {
"required": false,
"description": "Unique identifier.",
"type": "string"
},
"regular_price": {
"required": false,
"description": "Product regular price.",
"type": "string"
},
"sale_price": {
"required": false,
"description": "Product sale price.",
"type": "string"
},
"date_on_sale_from": {
"required": false,
"description": "Start date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_from_gmt": {
"required": false,
"description": "Start date of sale price, as GMT.",
"type": "date-time"
},
"date_on_sale_to": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"date_on_sale_to_gmt": {
"required": false,
"description": "End date of sale price, in the site's timezone.",
"type": "date-time"
},
"virtual": {
"required": false,
"description": "If the product is virtual.",
"type": "boolean"
},
"downloadable": {
"required": false,
"description": "If the product is downloadable.",
"type": "boolean"
},
"downloads": {
"required": false,
"description": "List of downloadable files.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "File ID.",
"type": "string",
"context": [
"view",
"edit"
]
},
"name": {
"description": "File name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"file": {
"description": "File URL.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"download_limit": {
"required": false,
"description": "Number of times downloadable files can be downloaded after purchase.",
"type": "integer"
},
"download_expiry": {
"required": false,
"description": "Number of days until access to downloadable files expires.",
"type": "integer"
},
"external_url": {
"required": false,
"description": "Product external URL. Only for external products.",
"type": "string"
},
"button_text": {
"required": false,
"description": "Product external button text. Only for external products.",
"type": "string"
},
"tax_status": {
"required": false,
"enum": [
"taxable",
"shipping",
"none"
],
"description": "Tax status.",
"type": "string"
},
"tax_class": {
"required": false,
"description": "Tax class.",
"type": "string"
},
"manage_stock": {
"required": false,
"description": "Stock management at product level.",
"type": "boolean"
},
"stock_quantity": {
"required": false,
"description": "Stock quantity.",
"type": "integer"
},
"stock_status": {
"required": false,
"enum": [
"instock",
"outofstock",
"onbackorder"
],
"description": "Controls the stock status of the product.",
"type": "string"
},
"backorders": {
"required": false,
"enum": [
"no",
"notify",
"yes"
],
"description": "If managing stock, this controls if backorders are allowed.",
"type": "string"
},
"sold_individually": {
"required": false,
"description": "Allow one item to be bought in a single order.",
"type": "boolean"
},
"weight": {
"required": false,
"description": "Product weight (oz).",
"type": "string"
},
"dimensions": {
"required": false,
"description": "Product dimensions.",
"type": "object"
},
"shipping_class": {
"required": false,
"description": "Shipping class slug.",
"type": "string"
},
"reviews_allowed": {
"required": false,
"description": "Allow reviews.",
"type": "boolean"
},
"upsell_ids": {
"required": false,
"description": "List of up-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"cross_sell_ids": {
"required": false,
"description": "List of cross-sell products IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"parent_id": {
"required": false,
"description": "Product parent ID.",
"type": "integer"
},
"purchase_note": {
"required": false,
"description": "Optional note to send the customer after purchase.",
"type": "string"
},
"categories": {
"required": false,
"description": "List of categories.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Category ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Category name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Category slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"tags": {
"required": false,
"description": "List of tags.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Tag ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Tag name.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
},
"slug": {
"description": "Tag slug.",
"type": "string",
"context": [
"view",
"edit"
],
"readonly": true
}
}
}
},
"images": {
"required": false,
"description": "List of images.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Image ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"date_created": {
"description": "The date the image was created, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_created_gmt": {
"description": "The date the image was created, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified": {
"description": "The date the image was last modified, in the site's timezone.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"date_modified_gmt": {
"description": "The date the image was last modified, as GMT.",
"type": "date-time",
"context": [
"view",
"edit"
],
"readonly": true
},
"src": {
"description": "Image URL.",
"type": "string",
"format": "uri",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Image name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"alt": {
"description": "Image alternative text.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"attributes": {
"required": false,
"description": "List of attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"position": {
"description": "Attribute position.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"visible": {
"description": "Define if the attribute is visible on the \"Additional information\" tab in the product's page.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"variation": {
"description": "Define if the attribute can be used as variation.",
"type": "boolean",
"default": false,
"context": [
"view",
"edit"
]
},
"options": {
"description": "List of available term names of the attribute.",
"type": "array",
"items": {
"type": "string"
},
"context": [
"view",
"edit"
]
}
}
}
},
"default_attributes": {
"required": false,
"description": "Defaults variation attributes.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Attribute ID.",
"type": "integer",
"context": [
"view",
"edit"
]
},
"name": {
"description": "Attribute name.",
"type": "string",
"context": [
"view",
"edit"
]
},
"option": {
"description": "Selected attribute term name.",
"type": "string",
"context": [
"view",
"edit"
]
}
}
}
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort products.",
"type": "integer"
},
"meta_data": {
"required": false,
"description": "Meta data.",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Meta ID.",
"type": "integer",
"context": [
"view",
"edit"
],
"readonly": true
},
"key": {
"description": "Meta key.",
"type": "string",
"context": [
"view",
"edit"
]
},
"value": {
"description": "Meta value.",
"type": "mixed",
"context": [
"view",
"edit"
]
}
}
}
},
"apply_adjacent_buffer": {
"required": false,
"description": "Apply adjacent buffers.",
"type": "boolean"
},
"availability": {
"required": false,
"description": "Availability rules defined on product level.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Availability type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"bookable": {
"description": "Rule marks things as bookable or not, 'yes' or 'no'.",
"type": "string",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"block_cost": {
"required": false,
"description": "Base cost of each block.",
"type": "number"
},
"buffer_period": {
"required": false,
"description": "Required buffer Period between bookings.",
"type": "integer"
},
"calendar_display_mode": {
"required": false,
"enum": [
"",
"always_visible"
],
"description": "How the calendar will display on the product page. Valid values are 'always_visible' or ''.",
"type": "string"
},
"cancel_limit_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "The unit limit is defined in. Valid values are 'month', 'day', 'hour', and 'minute'.",
"type": "string"
},
"cancel_limit": {
"required": false,
"description": "How many limit units in advance users are allowed to cancel bookings.",
"type": "integer"
},
"check_start_block_only": {
"required": false,
"description": "If true only the first block in checked for availability.",
"type": "boolean"
},
"cost": {
"required": false,
"description": "Product cost.",
"type": "number"
},
"default_date_availability": {
"required": false,
"enum": [
"",
"available"
],
"description": "If 'available' product is bookable unless made unbookable by availability rules.",
"type": "string"
},
"display_cost": {
"required": false,
"description": "Product cost displayed.",
"type": "string"
},
"duration_type": {
"required": false,
"enum": [
"customer",
"fixed"
],
"description": "How duration is defined.",
"type": "string"
},
"duration_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"minute"
],
"description": "Unit duration is defined in.",
"type": "string"
},
"duration": {
"required": false,
"description": "Size in duration units of each block.",
"type": "integer"
},
"enable_range_picker": {
"required": false,
"description": "Customer can pick a range of days on calendar.",
"type": "boolean"
},
"first_block_time": {
"required": false,
"description": "Time of day first block starts.",
"type": "string"
},
"has_person_cost_multiplier": {
"required": false,
"description": "Will multiply cost by number of persons.",
"type": "boolean"
},
"has_person_qty_multiplier": {
"required": false,
"description": "Each person counts as a booking.",
"type": "boolean"
},
"has_person_types": {
"required": false,
"description": "Product has different types of persons.",
"type": "boolean"
},
"has_persons": {
"required": false,
"description": "Product has persons defined.",
"type": "boolean"
},
"has_resources": {
"required": false,
"description": "Product has resources defined.",
"type": "boolean"
},
"has_restricted_days": {
"required": false,
"description": "Product has restricted days.",
"type": "boolean"
},
"max_date": {
"required": false,
"description": "Max date value combined with max date unit.",
"type": "string"
},
"max_date_value": {
"required": false,
"description": "Max amount af max_date_units into the future a block is bookable.",
"type": "integer"
},
"max_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for max_date_value.",
"type": "string"
},
"min_date": {
"required": false,
"description": "Min date value combined with min date unit.",
"type": "string"
},
"min_date_value": {
"required": false,
"description": "Min amount af min_date_units into the future a block is bookable.",
"type": "integer"
},
"min_date_unit": {
"required": false,
"enum": [
"month",
"day",
"hour",
"week"
],
"description": "Units for min_date_value.",
"type": "string"
},
"max_duration": {
"required": false,
"description": "Max duration of units a booking can be.",
"type": "integer"
},
"min_duration": {
"required": false,
"description": "Min duration of units a booking can be.",
"type": "integer"
},
"max_persons": {
"required": false,
"description": "Max persons which can be booked per booking.",
"type": "integer"
},
"min_persons": {
"required": false,
"description": "Min persons which can be booked per booking.",
"type": "integer"
},
"pricing": {
"required": false,
"description": "Pricing rules.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"description": "Date range type.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from": {
"description": "Starting month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"to": {
"description": "Ending month/day/week inclusive.",
"type": "string",
"context": [
"view",
"edit"
]
},
"from_date": {
"description": "Starting day if 'from' is a time.,",
"type": "string",
"context": [
"view",
"edit"
]
},
"to_date": {
"description": "Ending day if 'to' is a time.",
"type": "string",
"context": [
"view",
"edit"
]
},
"modifier": {
"description": "How the block cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"cost": {
"description": "Block cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"base_modifier": {
"description": "How the base cost should be modified.",
"type": "string",
"enum": [
"+",
"minus",
"times",
"divide",
"equals"
],
"context": [
"view",
"edit"
]
},
"base_cost": {
"description": "Base cost.",
"type": "number",
"context": [
"view",
"edit"
]
},
"priority": {
"description": "Priority of rule.",
"type": "integer",
"context": [
"view",
"edit"
]
}
}
}
},
"qty": {
"required": false,
"description": "Max bookings per block.",
"type": "integer"
},
"requires_confirmation": {
"required": false,
"description": "Booking require confirmation.",
"type": "boolean"
},
"restricted_days": {
"required": false,
"description": "Days days of week bookings cannot start. Array of numeric day indexes with 0 being Sunday.",
"type": "array",
"items": {
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6
]
}
},
"can_be_cancelled": {
"required": false,
"description": "Booking can be cancelled by customer.",
"type": "boolean"
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/products/batch"
}
},
"/wc-bookings/v1/products/categories": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"default": "view",
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
},
"page": {
"required": false,
"default": 1,
"description": "Current page of the collection.",
"type": "integer"
},
"per_page": {
"required": false,
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"type": "integer"
},
"search": {
"required": false,
"description": "Limit results to those matching a string.",
"type": "string"
},
"exclude": {
"required": false,
"default": [],
"description": "Ensure result set excludes specific IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"include": {
"required": false,
"default": [],
"description": "Limit result set to specific ids.",
"type": "array",
"items": {
"type": "integer"
}
},
"order": {
"required": false,
"default": "asc",
"enum": [
"asc",
"desc"
],
"description": "Order sort attribute ascending or descending.",
"type": "string"
},
"orderby": {
"required": false,
"default": "name",
"enum": [
"id",
"include",
"name",
"slug",
"term_group",
"description",
"count"
],
"description": "Sort collection by resource attribute.",
"type": "string"
},
"hide_empty": {
"required": false,
"default": false,
"description": "Whether to hide resources not assigned to any products.",
"type": "boolean"
},
"parent": {
"required": false,
"description": "Limit result set to resources assigned to a specific parent.",
"type": "integer"
},
"product": {
"required": false,
"description": "Limit result set to resources assigned to a specific product.",
"type": "integer"
},
"slug": {
"required": false,
"description": "Limit result set to resources with a specific slug.",
"type": "string"
}
}
},
{
"methods": [
"POST"
],
"args": {
"name": {
"required": true,
"description": "Name for the resource.",
"type": "string"
},
"slug": {
"required": false,
"description": "An alphanumeric identifier for the resource unique to its type.",
"type": "string"
},
"parent": {
"required": false,
"description": "The ID for the parent of the resource.",
"type": "integer"
},
"description": {
"required": false,
"description": "HTML description of the resource.",
"type": "string"
},
"display": {
"required": false,
"default": "default",
"enum": [
"default",
"products",
"subcategories",
"both"
],
"description": "Category archive display type.",
"type": "string"
},
"image": {
"required": false,
"description": "Image data.",
"type": "object"
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort the resource.",
"type": "integer"
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/products/categories"
}
},
"/wc-bookings/v1/products/categories/(?P<id>[\\d]+)": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"context": {
"required": false,
"default": "view",
"enum": [
"view",
"edit"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
}
}
},
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"name": {
"required": false,
"description": "Category name.",
"type": "string"
},
"slug": {
"required": false,
"description": "An alphanumeric identifier for the resource unique to its type.",
"type": "string"
},
"parent": {
"required": false,
"description": "The ID for the parent of the resource.",
"type": "integer"
},
"description": {
"required": false,
"description": "HTML description of the resource.",
"type": "string"
},
"display": {
"required": false,
"enum": [
"default",
"products",
"subcategories",
"both"
],
"description": "Category archive display type.",
"type": "string"
},
"image": {
"required": false,
"description": "Image data.",
"type": "object"
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort the resource.",
"type": "integer"
}
}
},
{
"methods": [
"DELETE"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"force": {
"required": false,
"default": false,
"description": "Required to be true, as resource does not support trashing.",
"type": "boolean"
}
}
}
]
},
"/wc-bookings/v1/products/categories/batch": {
"namespace": "wc-bookings/v1",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"name": {
"required": false,
"description": "Category name.",
"type": "string"
},
"slug": {
"required": false,
"description": "An alphanumeric identifier for the resource unique to its type.",
"type": "string"
},
"parent": {
"required": false,
"description": "The ID for the parent of the resource.",
"type": "integer"
},
"description": {
"required": false,
"description": "HTML description of the resource.",
"type": "string"
},
"display": {
"required": false,
"enum": [
"default",
"products",
"subcategories",
"both"
],
"description": "Category archive display type.",
"type": "string"
},
"image": {
"required": false,
"description": "Image data.",
"type": "object"
},
"menu_order": {
"required": false,
"description": "Menu order, used to custom sort the resource.",
"type": "integer"
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/products/categories/batch"
}
},
"/wc-bookings/v1/resources": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"default": "view",
"enum": [
"view"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
},
"page": {
"required": false,
"default": 1,
"description": "Current page of the collection.",
"type": "integer"
},
"per_page": {
"required": false,
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"type": "integer"
},
"search": {
"required": false,
"description": "Limit results to those matching a string.",
"type": "string"
},
"after": {
"required": false,
"description": "Limit response to resources published after a given ISO8601 compliant date.",
"type": "string"
},
"before": {
"required": false,
"description": "Limit response to resources published before a given ISO8601 compliant date.",
"type": "string"
},
"exclude": {
"required": false,
"default": [],
"description": "Ensure result set excludes specific IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"include": {
"required": false,
"default": [],
"description": "Limit result set to specific ids.",
"type": "array",
"items": {
"type": "integer"
}
},
"offset": {
"required": false,
"description": "Offset the result set by a specific number of items.",
"type": "integer"
},
"order": {
"required": false,
"default": "desc",
"enum": [
"asc",
"desc"
],
"description": "Order sort attribute ascending or descending.",
"type": "string"
},
"orderby": {
"required": false,
"default": "date",
"enum": [
"date",
"id",
"include",
"title",
"slug"
],
"description": "Sort collection by object attribute.",
"type": "string"
}
}
},
{
"methods": [
"POST"
],
"args": {
"availability": {
"required": false,
"type": {
"description": "Availability date/time range type string.",
"type": "string",
"readonly": true,
"context": [
"view"
]
}
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/resources"
}
},
"/wc-bookings/v1/resources/(?P<id>[\\d]+)": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"context": {
"required": false,
"default": "view",
"enum": [
"view"
],
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
}
}
},
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"availability": {
"required": false,
"type": {
"description": "Availability date/time range type string.",
"type": "string",
"readonly": true,
"context": [
"view"
]
}
}
}
},
{
"methods": [
"DELETE"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"force": {
"required": false,
"default": false,
"description": "Whether to bypass trash and force deletion.",
"type": "boolean"
}
}
}
]
},
"/wc-bookings/v1/resources/batch": {
"namespace": "wc-bookings/v1",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"availability": {
"required": false,
"type": {
"description": "Availability date/time range type string.",
"type": "string",
"readonly": true,
"context": [
"view"
]
}
}
}
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/resources/batch"
}
},
"/wc-bookings/v1/bookings": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"default": "view",
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
},
"page": {
"required": false,
"default": 1,
"description": "Current page of the collection.",
"type": "integer"
},
"per_page": {
"required": false,
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"type": "integer"
},
"search": {
"required": false,
"description": "Limit results to those matching a string.",
"type": "string"
},
"after": {
"required": false,
"description": "Limit response to resources published after a given ISO8601 compliant date.",
"type": "string"
},
"before": {
"required": false,
"description": "Limit response to resources published before a given ISO8601 compliant date.",
"type": "string"
},
"exclude": {
"required": false,
"default": [],
"description": "Ensure result set excludes specific IDs.",
"type": "array",
"items": {
"type": "integer"
}
},
"include": {
"required": false,
"default": [],
"description": "Limit result set to specific ids.",
"type": "array",
"items": {
"type": "integer"
}
},
"offset": {
"required": false,
"description": "Offset the result set by a specific number of items.",
"type": "integer"
},
"order": {
"required": false,
"default": "desc",
"enum": [
"asc",
"desc"
],
"description": "Order sort attribute ascending or descending.",
"type": "string"
},
"orderby": {
"required": false,
"default": "date",
"enum": [
"date",
"id",
"include",
"title",
"slug"
],
"description": "Sort collection by object attribute.",
"type": "string"
}
}
},
{
"methods": [
"POST"
],
"args": []
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
},
"/wc-bookings/v1/bookings/(?P<id>[\\d]+)": {
"namespace": "wc-bookings/v1",
"methods": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"context": {
"required": false,
"default": "view",
"description": "Scope under which the request is made; determines fields present in response.",
"type": "string"
}
}
},
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
}
}
},
{
"methods": [
"DELETE"
],
"args": {
"id": {
"required": false,
"description": "Unique identifier for the resource.",
"type": "integer"
},
"force": {
"required": false,
"default": false,
"description": "Whether to bypass trash and force deletion.",
"type": "boolean"
}
}
}
]
},
"/wc-bookings/v1/bookings/batch": {
"namespace": "wc-bookings/v1",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": []
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/bookings/batch"
}
},
"/wc-bookings/v1/products/slots": {
"namespace": "wc-bookings/v1",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": []
}
],
"_links": {
"self": "https://example.com/wp-json/wc-bookings/v1/products/slots"
}
}
},
"_links": {
"up": [
{
"href": "https://example.com/wp-json/"
}
]
}
}
Bookings
The Bookings API allows you to create, read, and delete individual bookings as well as list multiple bookings.
Booking properties
Attribute | Type | Description |
---|---|---|
id |
integer | Unique identifier for the resource. read-only |
all_day |
boolean | A boolean describing if the booking is for an entire day. read-only |
cost |
string | Total booking cost. read-only |
customer_id |
integer | ID of customer that purchased the booking. read-only |
date_created |
integer | Timestamp of the time the booking was created. read-only |
date_modified |
integer | Timestamp of the time the booking was last updated. read-only |
end |
integer | Timestamp of the end time of the booking. read-only |
google_calendar_event_id |
string | A unique ID of a synced booking event to Google Calendar. read-only |
order_id |
integer | The order ID linked to the booking. read-only |
order_item_id |
integer | The unique order line item ID of the booking. read-only |
parent_id |
integer | The unique item ID of the parent post. read-only |
person_counts |
array | The number of persons by person type within the booking. read-only |
product_id |
integer | The unique product ID linked to the booking. read-only |
resource_id |
integer | The unique resource ID linked to the booking. read-only |
start |
integer | Timestamp of the start time of the booking. read-only |
status |
string | The current status of the booking. read-only |
local_timezone |
string | The local timezone used when the booking was purchased. read-only |
Create a booking (INCOMPLETE DO NOT USE!)
This API helps you to create a new booking.
HTTP request
/wp-json/wc-bookings/v1/bookings/
Example of creating a new booking:
curl -X POST https://example.com/wp-json/wc-bookings/v1/bookings/ \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"all_day": false,
"cost": "300",
"customer_id": 1,
"date_created": 1587634157,
"date_modified": 1587647729,
"end": 1588534200,
"order_item_id": 573,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1588528800,
"status": "publish",
"local_timezone": "Europe/Berlin"
}'
JSON response example:
{
"id": 688,
"all_day": false,
"cost": "0",
"customer_id": 0,
"date_created": 1587666559,
"date_modified": 1587666559,
"end": false,
"google_calendar_event_id": "0",
"order_id": 0,
"order_item_id": 0,
"parent_id": 0,
"person_counts": [],
"product_id": 0,
"resource_id": 0,
"start": false,
"status": "unpaid",
"local_timezone": "",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/688"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
}
Retrieve a booking
This API helps you to view an existing booking.
HTTP request
/wp-json/wc-bookings/v1/bookings/<id>
Example of viewing a specific booking:
curl https://example.com/wp-json/wc-bookings/v1/bookings/678 \
-u consumer_key:consumer_secret \
JSON response example:
{
"id": 678,
"all_day": false,
"cost": "200",
"customer_id": 1,
"date_created": 1587634157,
"date_modified": 1587634168,
"end": 1588534200,
"google_calendar_event_id": "0",
"order_id": 679,
"order_item_id": 573,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1588528800,
"status": "paid",
"local_timezone": "Europe/Berlin",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/678"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
}
List all bookings
This API lets you retrieve and view all bookings made on the site.
HTTP request
/wp-json/wc-bookings/v1/bookings/
curl https://example.com/wp-json/wc-bookings/v1/bookings/ \
-u consumer_key:consumer_secret
JSON response example:
[
{
"id": 678,
"all_day": false,
"cost": "200",
"customer_id": 1,
"date_created": 1587634157,
"date_modified": 1587634168,
"end": 1588534200,
"google_calendar_event_id": "0",
"order_id": 679,
"order_item_id": 573,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1588528800,
"status": "paid",
"local_timezone": "Europe/Berlin",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/678"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
},
{
"id": 677,
"all_day": false,
"cost": "200",
"customer_id": 1,
"date_created": 1587634151,
"date_modified": 1587634167,
"end": 1588455000,
"google_calendar_event_id": "0",
"order_id": 679,
"order_item_id": 572,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1588449600,
"status": "paid",
"local_timezone": "Europe/Berlin",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/677"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
},
{
"id": 676,
"all_day": false,
"cost": "200",
"customer_id": 1,
"date_created": 1587634146,
"date_modified": 1587634167,
"end": 1587936600,
"google_calendar_event_id": "0",
"order_id": 679,
"order_item_id": 571,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1587931200,
"status": "paid",
"local_timezone": "Europe/Berlin",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/676"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
}
]
Delete a booking
This API helps you to delete an existing booking, changing the booking's status to "trash".
HTTP request
/wp-json/wc-bookings/v1/bookings/<id>
Example of deleting a specific booking:
curl -X DELETE https://example.com/wp-json/wc-bookings/v1/bookings/678?force=true \
-u consumer_key:consumer_secret \
JSON response example:
{
"id": 678,
"all_day": false,
"cost": "200",
"customer_id": 1,
"date_created": 1587634157,
"date_modified": 1587647316,
"end": 1588534200,
"google_calendar_event_id": "0",
"order_id": 679,
"order_item_id": 573,
"parent_id": 0,
"person_counts": [
1
],
"product_id": 655,
"resource_id": 656,
"start": 1588528800,
"status": "trash",
"local_timezone": "Europe/Berlin",
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings/678"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/bookings"
}
]
}
}
Available parameters
Parameter | Type | Description |
---|---|---|
force |
string | Use true to permanently delete the product. Default is false. |
Resources
The resources API allows you to view all or individual Bookings resources.
Resource properties
Attribute | Type | Description |
---|---|---|
id |
integer | Unique identifier for the resource. read-only |
availability |
array | Array of availability rules. read-only |
base_cost |
integer | The base cost of the resource. read-only |
block_cost |
integer | The block cost of the resource. read-only |
name |
string | The given name for the resource. read-only |
parent_id |
integer | The parent post id. read-only |
qty |
integer | The available quantity of resource. read-only |
sort_order |
integer | Determines the sort order. read-only |
Resource - availability properties
Attribute | Type | Description |
---|---|---|
type |
string | Type of availability rule. |
bookable |
string | Whether the product is bookable or not("yes/no"). |
priority |
integer | Priority value of availability rule. |
from |
string | Start time of the availability rule. |
to |
string | End time of availability rule. |
Retrieve a resource
This API lets you retrieve and view a specific resource by ID.
HTTP request
/wp-json/wc-bookings/v1/resources/<id>
curl https://example.com/wp-json/wc-bookings/v1/resources/99 \
-u consumer_key:consumer_secret
JSON response example:
{
"id": 99,
"availability": [
{
"type": "time:6",
"bookable": "yes",
"priority": 10,
"from": "12:00",
"to": "20:00"
},
{
"type": "time:7",
"bookable": "yes",
"priority": 10,
"from": "12:00",
"to": "20:00"
},
{
"type": "custom",
"bookable": "no",
"priority": 9,
"from": "2019-05-18",
"to": "2019-05-18"
},
{
"type": "custom",
"bookable": "no",
"priority": 9,
"from": "2019-05-25",
"to": "2019-05-25"
}
],
"base_cost": 10,
"block_cost": 10,
"name": "Gym of Your Choice",
"parent_id": 0,
"qty": "1",
"sort_order": 0,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources/99"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources"
}
]
}
}
Available parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The post ID of a specific resource. |
List all resources
This API helps you to list all the resources that have been created.
HTTP request
/wp-json/wc-bookings/v1/resources
curl https://example.com/wp-json/wc-bookings/v1/resources \
-u consumer_key:consumer_secret
JSON response example:
[
{
"id": 99,
"availability": [
{
"type": "time:6",
"bookable": "yes",
"priority": 10,
"from": "12:00",
"to": "20:00"
},
{
"type": "time:7",
"bookable": "yes",
"priority": 10,
"from": "12:00",
"to": "20:00"
},
{
"type": "custom",
"bookable": "no",
"priority": 9,
"from": "2019-05-18",
"to": "2019-05-18"
},
{
"type": "custom",
"bookable": "no",
"priority": 9,
"from": "2019-05-25",
"to": "2019-05-25"
}
],
"base_cost": 0,
"block_cost": 0,
"name": "The Second Best Gym, San Jose",
"parent_id": 0,
"qty": "1",
"sort_order": 0,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources/657"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources"
}
]
}
},
{
"id": 98,
"availability": [
{
"type": "time:6",
"bookable": "yes",
"priority": 10,
"from": "18:00",
"to": "22:00"
},
{
"type": "time:7",
"bookable": "yes",
"priority": 10,
"from": "18:00",
"to": "22:00"
}
],
"base_cost": 0,
"block_cost": 0,
"name": "The Best Gym, Los Angeles",
"parent_id": 0,
"qty": "1",
"sort_order": 0,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources/656"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/resources"
}
]
}
}
]
Bookable Products
The products API allows you to read, update, and delete individual bookable products as well as list all bookable products.
Bookable Product properties
Attribute | Type | Description |
---|---|---|
id |
integer | Unique identifier for the product. read-only |
name |
string | Product name. |
slug |
string | Product slug. |
permalink |
string | Product URL. |
date_created |
date-time | The date the product was created, in the site's timezone. |
date_created_gmt |
date-time | The date the product was created, as GMT. |
date_modified |
date-time | The date the product was last modified, in the site's timezone. |
date_modified_gmt |
date-time | The date the product was last modified, as GMT. |
type |
string | Product type. Options: simple , grouped , external and variable . Default is simple . |
status |
string | Product status (post status). Options: draft , pending , private and publish . Default is publish . |
featured |
boolean | Featured product. Default is |
catalog_visibility |
string | Catalog visibility. Options: visible , catalog , search and hidden . Default is visible . |
description |
string | Product description. |
short_description |
string | Product short description. |
sku |
string | Unique identifier. |
price |
string | Current product price. |
regular_price |
string | Product regular price. |
sale_price |
string | Product sale price. |
date_on_sale_from |
date-time | Start date of sale price, in the site's timezone. |
date_on_sale_from_gmt |
date-time | Start date of sale price, as GMT. |
date_on_sale_to |
date-time | End date of sale price, in the site's timezone. |
date_on_sale_to_gmt |
date-time | End date of sale price, as GMT. |
price_html |
string | Price formatted in HTML. |
on_sale |
boolean | Shows if the product is on sale. |
purchasable |
boolean | Shows if the product can be bought. |
total_sales |
integer | Amount of sales. |
virtual |
boolean | If the product is virtual. Default is false . |
downloadable |
boolean | If the product is downloadable. Default is false . |
downloads |
array | List of downloadable files. |
download_limit |
integer | Number of times downloadable files can be downloaded after purchase. Default is -1 . |
download_expiry |
integer | Number of days until access to downloadable files expires. Default is -1 . |
external_url |
string | Product external URL. Only for external products. |
button_text |
string | Product external button text. Only for external products. |
tax_status |
string | Tax status. Options: taxable , shipping and none . Default is taxable . |
tax_class |
string | Tax class. |
manage_stock |
boolean | Stock management at product level. Default is false . |
stock_quantity |
integer | Stock quantity. |
stock_status |
string | Controls the stock status of the product. Options: instock , outofstock , onbackorder . Default is instock . |
backorders |
string | If managing stock, this controls if backorders are allowed. Options: no , notify and yes . Default is no . |
backorders_allowed |
boolean | Shows if backorders are allowed. |
backordered |
boolean | Shows if the product is on backordered. |
sold_individually |
boolean | Allow one item to be bought in a single order. Default is false . |
weight |
string | Product weight. |
dimensions |
object | Product dimensions. |
shipping_required |
boolean | Shows if the product need to be shipped. |
shipping_taxable |
boolean | Shows whether or not the product shipping is taxable. |
shipping_class |
string | Shipping class slug. |
shipping_class_id |
integer | Shipping class ID. |
reviews_allowed |
boolean | Allow reviews. Default is true . |
average_rating |
string | Reviews average rating. |
rating_count |
integer | Amount of reviews that the product have. |
related_ids |
array | List of related products IDs. |
upsell_ids |
array | List of up-sell products IDs. |
cross_sell_ids |
array | List of cross-sell products IDs. |
parent_id |
integer | Product parent ID. |
purchase_note |
string | Optional note to send the customer after purchase. |
categories |
array | List of categories. |
tags |
array | List of tags. |
images |
array | List of images. |
attributes |
array | List of attributes. |
default_attributes |
array | Defaults variation attributes. |
variations |
array | List of variations IDs. |
grouped_products |
array | List of grouped products ID. |
menu_order |
integer | Menu order, used to custom sort products. |
meta_data |
array | Meta data. |
apply_adjacent_buffer |
boolean | Use adjacent buffering for calculating availability. |
availability |
array | List of custom availability rules. |
block_cost |
integer | Block cost of the bookable product. |
buffer_period |
integer | Time(minutes) to apply a buffer between bookings. |
calendar_display_mode |
string | Calendar display mode on the product page. |
cancel_limit_unit |
string | The unit type for the cancellation limit. |
cancel_limit |
integer | The length of the cancellation limit. |
check_start_block_only |
boolean | Check availability only from the starting block. |
cost |
integer | The base cost of the bookable product. |
default_date_availability |
string | Make the bookable product available by default. |
display_cost |
string | String override for the booking display cost. |
duration_type |
string | The product's block duration(fixed or customer-defined). |
duration_unit |
string | The product's block duration unit type(minutes, hours, days). |
duration |
integer | The value of the block duration unit. |
enable_range_picker |
boolean | Enable date range selection on product pages. |
first_block_time |
string | Set a beginning time in which availability is calculated. |
has_person_cost_multiplier |
boolean | Multiply booking costs by number of persons. |
has_person_qty_multiplier |
boolean | Treat each person as a booking. |
has_person_types |
boolean | Enable person types for the product. |
has_persons |
boolean | Enable persons for the product. |
has_resources |
boolean | Enable resources for the product. |
has_restricted_days |
string | Days of week are disabled for availability ("1" or "0"). |
restricted_days |
object | Days of the week which are disabled, "0" through "6". |
max_duration |
integer | Maximum number of blocks per booking. |
min_duration |
integer | Minimum number of blocks per booking. |
max_persons |
integer | Maximum number of persons per booking. |
min_persons |
integer | Minimum number of persons per booking. |
person_types |
object | The person types attached to product, linked by ID. |
requires_confirmation |
boolean | Require admin confirmation for bookings of this product. |
resource_label |
string | Label shown on product page for resource selection. |
resource_base_costs |
object | The base cost per resource attached to product, linked by ID. |
resource_block_costs |
object | The block cost per resource attached to product, linked by ID. |
resource_ids |
object | The resources attached to product, linked by ID. |
resources_assignment |
object | How resources are chosen, either "automatic" or "customer". |
can_be_cancelled |
boolean | Allow cancellation of bookings. |
user_can_cancel |
boolean | Allow customer cancellation of bookings. |
Bookable Product - max_date properties
Attribute | Type | Description |
---|---|---|
value |
integer | Value of the maximum date bookings can be made in the future. |
unit |
string | Unit type("month, day") for maximum future booking date. |
Bookable Product - min_date properties
Attribute | Type | Description |
---|---|---|
value |
integer | Value of the minimum date bookings can be made in the future. |
unit |
string | Unit type("month, day") for minimum future booking date. |
Bookable Product - pricing properties
Attribute | Type | Description |
---|---|---|
type |
string | The custom pricing rule type. |
cost |
string | Custom block cost. |
modifier |
string | Modifier type for calculating block cost. |
cost |
string | Custom base cost. |
from |
string | Minimum value to apply cost rule. |
to |
string | Maximum value to apply cost rule. |
base_modifier |
string | Modifier type for calculating base cost. |
Retrieve a bookable product
This API lets you retrieve and view a specific bookable product by ID.
HTTP request
/wp-json/wc-bookings/v1/products/<id>
curl https://example.com/wp-json/wc-bookings/v1/products/655 \
-u consumer_key:consumer_secret
JSON response example:
{
"id": 655,
"name": "Fitness Photo Shoot",
"slug": "fitness-photo-shoot",
"permalink": "https://example.com/product/fitness-photo-shoot/",
"date_created": "2020-04-09T13:38:30",
"date_created_gmt": "2020-04-09T13:38:30",
"date_modified": "2020-04-22T19:04:49",
"date_modified_gmt": "2020-04-22T19:04:49",
"type": "booking",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "200",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "From: <span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>200.00</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 4,
"virtual": true,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": true,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": false,
"shipping_taxable": false,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
658,
588,
523,
673,
659
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 18087,
"key": "_wc_booking_base_cost",
"value": "0"
},
{
"id": 18117,
"key": "_wc_booking_resouce_label",
"value": ""
},
{
"id": 18134,
"key": "_product_addons",
"value": []
},
{
"id": 18135,
"key": "_product_addons_exclude_global",
"value": "0"
},
{
"id": 18895,
"key": "_nyp",
"value": "no"
},
{
"id": 18896,
"key": "_suggested_price",
"value": ""
},
{
"id": 18897,
"key": "_min_price",
"value": ""
},
{
"id": 18898,
"key": "_hide_nyp_minimum",
"value": "no"
},
{
"id": 18899,
"key": "_maximum_price",
"value": ""
},
{
"id": 18900,
"key": "_wcopc",
"value": "no"
}
],
"apply_adjacent_buffer": false,
"availability": [],
"block_cost": 0,
"buffer_period": 30,
"calendar_display_mode": "always_visible",
"cancel_limit_unit": "month",
"cancel_limit": 1,
"check_start_block_only": false,
"cost": 200,
"default_date_availability": "non-available",
"display_cost": "",
"duration_type": "fixed",
"duration_unit": "minute",
"duration": 90,
"enable_range_picker": false,
"first_block_time": "",
"has_person_cost_multiplier": false,
"has_person_qty_multiplier": false,
"has_person_types": false,
"has_persons": true,
"has_resources": true,
"has_restricted_days": "",
"max_date": {
"value": 6,
"unit": "month"
},
"max_date_value": 6,
"max_date_unit": "month",
"max_duration": 1,
"max_persons": 2,
"min_date": {
"value": 0,
"unit": "month"
},
"min_date_value": 0,
"min_date_unit": "month",
"min_duration": 1,
"min_persons": 1,
"person_types": [],
"pricing": [
{
"type": "persons",
"cost": "",
"modifier": "",
"base_cost": "60",
"base_modifier": "",
"from": "2",
"to": "2"
}
],
"qty": 1,
"requires_confirmation": false,
"resource_label": "Shoot Location",
"resource_base_costs": {
"656": "",
"657": "50"
},
"resource_block_costs": {
"656": "",
"657": ""
},
"resource_ids": [
656,
657
],
"resources_assignment": "customer",
"restricted_days": {
"0": "0",
"6": "6"
},
"can_be_cancelled": false,
"user_can_cancel": false,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/655"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products"
}
]
}
}
List all bookable products
This API helps you to view all published bookable products.
HTTP request
/wp-json/wc-bookings/v1/products
curl https://example.com/wp-json/wc-bookings/v1/products \
-u consumer_key:consumer_secret
JSON response example:
[
{
"id": 680,
"name": "Personal Trainer Session",
"slug": "personal-trainer-session",
"permalink": "https://example.com/product/personal-trainer-session/",
"date_created": "2020-04-23T10:12:27",
"date_created_gmt": "2020-04-23T10:12:27",
"date_modified": "2020-04-23T10:13:20",
"date_modified_gmt": "2020-04-23T10:13:20",
"type": "booking",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "100",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "From: <span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>100.00</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": true,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": true,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": false,
"shipping_taxable": false,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
659,
663,
655,
673,
523
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 19191,
"key": "_wc_booking_base_cost",
"value": "0"
},
{
"id": 19192,
"key": "_wc_booking_resouce_label",
"value": ""
},
{
"id": 19193,
"key": "_product_addons",
"value": []
},
{
"id": 19194,
"key": "_product_addons_exclude_global",
"value": "0"
},
{
"id": 19195,
"key": "_nyp",
"value": "no"
},
{
"id": 19196,
"key": "_suggested_price",
"value": ""
},
{
"id": 19197,
"key": "_min_price",
"value": ""
},
{
"id": 19198,
"key": "_hide_nyp_minimum",
"value": "no"
},
{
"id": 19199,
"key": "_maximum_price",
"value": ""
},
{
"id": 19200,
"key": "_wcopc",
"value": "no"
}
],
"apply_adjacent_buffer": false,
"availability": [],
"block_cost": 0,
"buffer_period": 30,
"calendar_display_mode": "always_visible",
"cancel_limit_unit": "month",
"cancel_limit": 1,
"check_start_block_only": false,
"cost": 100,
"default_date_availability": "non-available",
"display_cost": "",
"duration_type": "fixed",
"duration_unit": "minute",
"duration": 90,
"enable_range_picker": false,
"first_block_time": "",
"has_person_cost_multiplier": false,
"has_person_qty_multiplier": false,
"has_person_types": false,
"has_persons": true,
"has_resources": true,
"has_restricted_days": "",
"max_date": {
"value": 6,
"unit": "month"
},
"max_date_value": 6,
"max_date_unit": "month",
"max_duration": 1,
"max_persons": 2,
"min_date": {
"value": 0,
"unit": "month"
},
"min_date_value": 0,
"min_date_unit": "month",
"min_duration": 1,
"min_persons": 1,
"person_types": [],
"pricing": [
{
"type": "persons",
"cost": "",
"modifier": "",
"base_cost": "60",
"base_modifier": "",
"from": "2",
"to": "2"
}
],
"qty": 1,
"requires_confirmation": false,
"resource_label": "Training Location",
"resource_base_costs": {
"656": "",
"657": "50"
},
"resource_block_costs": {
"656": "",
"657": ""
},
"resource_ids": [
656,
657
],
"resources_assignment": "customer",
"restricted_days": {
"0": "0",
"6": "6"
},
"can_be_cancelled": false,
"user_can_cancel": false,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/680"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products"
}
]
}
},
{
"id": 655,
"name": "Fitness Photo Shoot",
"slug": "fitness-photo-shoot",
"permalink": "https://example.com/product/fitness-photo-shoot/",
"date_created": "2020-04-09T13:38:30",
"date_created_gmt": "2020-04-09T13:38:30",
"date_modified": "2020-04-22T19:04:49",
"date_modified_gmt": "2020-04-22T19:04:49",
"type": "booking",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "200",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "From: <span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>200.00</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 4,
"virtual": true,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": true,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": false,
"shipping_taxable": false,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
510,
522,
523,
663,
673
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 18087,
"key": "_wc_booking_base_cost",
"value": "0"
},
{
"id": 18117,
"key": "_wc_booking_resouce_label",
"value": ""
},
{
"id": 18134,
"key": "_product_addons",
"value": []
},
{
"id": 18135,
"key": "_product_addons_exclude_global",
"value": "0"
},
{
"id": 18895,
"key": "_nyp",
"value": "no"
},
{
"id": 18896,
"key": "_suggested_price",
"value": ""
},
{
"id": 18897,
"key": "_min_price",
"value": ""
},
{
"id": 18898,
"key": "_hide_nyp_minimum",
"value": "no"
},
{
"id": 18899,
"key": "_maximum_price",
"value": ""
},
{
"id": 18900,
"key": "_wcopc",
"value": "no"
}
],
"apply_adjacent_buffer": false,
"availability": [],
"block_cost": 0,
"buffer_period": 30,
"calendar_display_mode": "always_visible",
"cancel_limit_unit": "month",
"cancel_limit": 1,
"check_start_block_only": false,
"cost": 200,
"default_date_availability": "non-available",
"display_cost": "",
"duration_type": "fixed",
"duration_unit": "minute",
"duration": 90,
"enable_range_picker": false,
"first_block_time": "",
"has_person_cost_multiplier": false,
"has_person_qty_multiplier": false,
"has_person_types": false,
"has_persons": true,
"has_resources": true,
"has_restricted_days": "",
"max_date": {
"value": 6,
"unit": "month"
},
"max_date_value": 6,
"max_date_unit": "month",
"max_duration": 1,
"max_persons": 2,
"min_date": {
"value": 0,
"unit": "month"
},
"min_date_value": 0,
"min_date_unit": "month",
"min_duration": 1,
"min_persons": 1,
"person_types": [],
"pricing": [
{
"type": "persons",
"cost": "",
"modifier": "",
"base_cost": "60",
"base_modifier": "",
"from": "2",
"to": "2"
}
],
"qty": 1,
"requires_confirmation": false,
"resource_label": "Shoot Location",
"resource_base_costs": {
"656": "",
"657": "50"
},
"resource_block_costs": {
"656": "",
"657": ""
},
"resource_ids": [
656,
657
],
"resources_assignment": "customer",
"restricted_days": {
"0": "0",
"6": "6"
},
"can_be_cancelled": false,
"user_can_cancel": false,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/655"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products"
}
]
}
}
]
Available parameters
Parameter | Type | Description |
---|---|---|
resource |
integer | Resource ID attached to a bookable product. |
page |
integer | Current page of the collection. Default is 1 . |
per_page |
integer | Maximum number of items to be returned in result set. Default is 10 . |
search |
string | Limit results to those matching a string. |
after |
string | Limit response to resources published after a given ISO8601 compliant date. |
before |
string | Limit response to resources published before a given ISO8601 compliant date. |
exclude |
array | Ensure result set excludes specific IDs. |
include |
array | Limit result set to specific ids. |
offset |
integer | Offset the result set by a specific number of items. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc . Default is desc . |
orderby |
string | Sort collection by object attribute. Options: date , id , include , title and slug . Default is date . |
parent |
array | Limit result set to those of particular parent IDs. |
parent_exclude |
array | Limit result set to all items except those of a particular parent ID. |
slug |
string | Limit result set to products with a specific slug. |
status |
string | Limit result set to products assigned a specific status. Options: any , draft , pending , private and publish . Default is any . |
type |
string | Limit result set to products assigned a specific type. Options: simple , grouped , external and variable . |
sku |
string | Limit result set to products with a specific SKU. |
featured |
boolean | Limit result set to featured products. |
category |
string | Limit result set to products assigned a specific category ID. |
tag |
string | Limit result set to products assigned a specific tag ID. |
shipping_class |
string | Limit result set to products assigned a specific shipping class ID. |
attribute |
string | Limit result set to products with a specific attribute. |
attribute_term |
string | Limit result set to products with a specific attribute term ID (required an assigned attribute). |
tax_class |
string | Limit result set to products with a specific tax class. Default options: standard , reduced-rate and zero-rate . |
on_sale |
boolean | Limit result set to products on sale. |
min_price |
string | Limit result set to products based on a minimum price. |
max_price |
string | Limit result set to products based on a maximum price. |
stock_status |
string | Limit result set to products with specified stock status. Options: instock , outofstock and onbackorder . |
Update a bookable product
This API helps you to update an existing bookable product.
HTTP request
/wp-json/wc-bookings/v1/products/<id>
Example of updating an existing booking:
curl -X PUT https://example.com/wp-json/wc-bookings/v1/products/684 \
-u consumer_key:consumer_secret \
-d '{
"name": "Fitness Video Shoot",
"cost": 50,
"featured": true,
"requires_confirmation": true
}'
JSON response example:
{
"id": 684,
"name": "Fitness Video Shoot",
"slug": "product-2",
"permalink": "https://example.com/product/product-2/",
"date_created": "2020-04-23T13:38:43",
"date_created_gmt": "2020-04-23T13:38:43",
"date_modified": "2020-04-23T13:43:58",
"date_modified_gmt": "2020-04-23T13:43:58",
"type": "booking",
"status": "publish",
"featured": true,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "50",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>50.00</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": true,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"related_ids": [
663,
523,
680,
655,
510
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [],
"apply_adjacent_buffer": false,
"availability": [],
"block_cost": 0,
"buffer_period": 0,
"calendar_display_mode": "always_visible",
"cancel_limit_unit": "month",
"cancel_limit": 1,
"check_start_block_only": false,
"cost": 50,
"default_date_availability": "",
"display_cost": "",
"duration_type": "fixed",
"duration_unit": "day",
"duration": 1,
"enable_range_picker": false,
"first_block_time": "",
"has_person_cost_multiplier": false,
"has_person_qty_multiplier": false,
"has_person_types": false,
"has_persons": false,
"has_resources": false,
"has_restricted_days": "",
"max_date_value": 12,
"max_date_unit": "month",
"max_duration": 1,
"max_persons": 1,
"min_date_value": 0,
"min_date_unit": "day",
"min_duration": 1,
"min_persons": 1,
"person_types": [],
"pricing": [],
"qty": 1,
"requires_confirmation": true,
"resource_label": "",
"resource_base_costs": [],
"resource_block_costs": [],
"resource_ids": [],
"resources_assignment": "",
"restricted_days": "",
"can_be_cancelled": false,
"user_can_cancel": false,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/684"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products"
}
]
}
}
Available parameters
Parameter | Type | Description |
---|---|---|
resource_ids |
array | Resource IDs attached to a bookable product. |
parent |
array | Set parent post ID. |
slug |
string | Set bookable product slug. |
status |
string | Change status of bookable product. Options: any , draft , pending , private and publish . Default is any . |
featured |
boolean | Set bookable product as a featured product. |
categories |
array | Set the categories assigned to the bookable product. |
tags |
array | Set the tags assigned to the bookable product. |
tax_class |
string | Set tax class assigned to the bookable product. Default options: standard , reduced-rate and zero-rate . |
on_sale |
boolean | Set bookable product on sale. |
stock_status |
string | Set product stock status. Options: instock , outofstock and onbackorder . |
apply_adjacent_buffer |
boolean | Use adjacent buffering for calculating availability. |
availability |
array | List of custom availability rules. |
block_cost |
integer | Block cost of the bookable product. |
buffer_period |
integer | Time(minutes) to apply a buffer between bookings. |
calendar_display_mode |
string | Calendar display mode on the product page. |
cancel_limit_unit |
string | The unit type for the cancellation limit. |
cancel_limit |
integer | The length of the cancellation limit. |
check_start_block_only |
boolean | Check availability only from the starting block. |
cost |
integer | The base cost of the bookable product. |
default_date_availability |
string | Make the bookable product available by default. |
display_cost |
string | String override for the booking display cost. |
duration_type |
string | The product's block duration(fixed or customer-defined). |
duration_unit |
string | The product's block duration unit type(minutes, hours, days). |
duration |
integer | The value of the block duration unit. |
enable_range_picker |
boolean | Enable date range selection on product pages. |
first_block_time |
string | Set a beginning time in which availability is calculated. |
has_person_cost_multiplier |
boolean | Multiply booking costs by number of persons. |
has_person_qty_multiplier |
boolean | Treat each person as a booking. |
has_person_types |
boolean | Enable person types for the product. |
has_persons |
boolean | Enable persons for the product. |
has_resources |
boolean | Enable resources for the product. |
has_restricted_days |
string | Days of week are disabled for availability ("1" or "0"). |
restricted_days |
object | Days of the week which are disabled, "0" through "6". |
max_duration |
integer | Maximum number of blocks per booking. |
min_duration |
integer | Minimum number of blocks per booking. |
max_persons |
integer | Maximum number of persons per booking. |
min_persons |
integer | Minimum number of persons per booking. |
person_types |
object | The person types attached to product, linked by ID. |
requires_confirmation |
boolean | Require admin confirmation for bookings of this product. |
resource_label |
string | Label shown on product page for resource selection. |
resource_base_costs |
object | The base cost per resource attached to product, linked by ID. |
resource_block_costs |
object | The block cost per resource attached to product, linked by ID. |
resource_ids |
object | The resources attached to product, linked by ID. |
resources_assignment |
object | How resources are chosen, either "automatic" or "customer". |
can_be_cancelled |
boolean | Allow cancellation of bookings. |
user_can_cancel |
boolean | Allow customer cancellation of bookings. |
Delete a bookable product
This API helps you to delete an existing bookable product, changing the post status to "trash".
HTTP request
/wp-json/wc-bookings/v1/bookings/products/<id>
Example of deleting a specific booking:
curl -X DELETE https://example.com/wp-json/wc-bookings/v1/bookings/products/678 \
-u consumer_key:consumer_secret \
JSON response example:
{
"id": 684,
"name": "Fitness Video Shoot",
"slug": "product-2",
"permalink": "https://example.com/product/product-2/",
"date_created": "2020-04-23T13:38:43",
"date_created_gmt": "2020-04-23T13:38:43",
"date_modified": "2020-04-23T13:49:55",
"date_modified_gmt": "2020-04-23T13:49:55",
"type": "booking",
"status": "publish",
"featured": true,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "50",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><span class=\"woocommerce-Price-currencySymbol\">$</span>50.00</span>",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": true,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"related_ids": [
522,
510,
663,
659,
680
],
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized"
}
],
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [],
"apply_adjacent_buffer": false,
"availability": [],
"block_cost": 0,
"buffer_period": 0,
"calendar_display_mode": "always_visible",
"cancel_limit_unit": "month",
"cancel_limit": 1,
"check_start_block_only": false,
"cost": 50,
"default_date_availability": "",
"display_cost": "",
"duration_type": "fixed",
"duration_unit": "day",
"duration": 1,
"enable_range_picker": false,
"first_block_time": "",
"has_person_cost_multiplier": false,
"has_person_qty_multiplier": false,
"has_person_types": false,
"has_persons": false,
"has_resources": false,
"has_restricted_days": "",
"max_date_value": 12,
"max_date_unit": "month",
"max_duration": 1,
"max_persons": 1,
"min_date_value": 0,
"min_date_unit": "day",
"min_duration": 1,
"min_persons": 1,
"person_types": [],
"pricing": [],
"qty": 1,
"requires_confirmation": true,
"resource_label": "",
"resource_base_costs": [],
"resource_block_costs": [],
"resource_ids": [],
"resources_assignment": "",
"restricted_days": "",
"can_be_cancelled": false,
"user_can_cancel": false,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/684"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products"
}
]
}
}
Product categories
The product categories API allows you to list all categories which have published bookable products.
Product category properties
Attribute | Type | Description |
---|---|---|
id |
integer | Unique identifier for the category. read-only |
name |
string | Category name. read-only |
slug |
string | An alphanumeric identifier for the category unique to its type.read-only |
parent |
integer | The ID for the parent of the category. read-only |
description |
string | HTML description of the category. read-only |
display |
string | Category archive display type. Options: default , products , subcategories and both . Default is default . read-only |
image |
object | Image data. read-only |
menu_order |
integer | Menu order, used to custom sort the category. read-only |
count |
integer | Number of published products for the resource. read-only |
List all product categories
This API lets you retrieve all product categories which have bookable products.
/wp-json/wc-bookings/v1/products/categories
curl https://example.com/wp-json/wc-bookings/v1/products/categories \
-u consumer_key:consumer_secret
JSON response example:
[
{
"id": 45,
"name": "Bookings",
"slug": "bookings",
"parent": 0,
"description": "",
"display": "default",
"image": null,
"menu_order": 0,
"count": 1,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/categories/45"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/categories"
}
]
}
},
{
"id": 15,
"name": "Uncategorized",
"slug": "uncategorized",
"parent": 0,
"description": "",
"display": "default",
"image": null,
"menu_order": 0,
"count": 13,
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/categories/15"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc-bookings/v1/products/categories"
}
]
}
}
]
Available parameters
Parameter | Type | Description |
---|---|---|
context |
string | Scope under which the request is made; determines fields present in response. Options: view and edit . Default is view . |
page |
integer | Current page of the collection. Default is 1 . |
per_page |
integer | Maximum number of items to be returned in result set. Default is 10 . |
search |
string | Limit results to those matching a string. |
exclude |
array | Ensure result set excludes specific ids. |
include |
array | Limit result set to specific ids. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc . Default is asc . |
orderby |
string | Sort collection by resource attribute. Options: id , include , name , slug , term_group , description and count . Default is name . |
hide_empty |
boolean | Whether to hide resources not assigned to any products. Default is false . |
parent |
integer | Limit result set to resources assigned to a specific parent. |
product |
integer | Limit result set to resources assigned to a specific product. |
slug |
string | Limit result set to resources with a specific slug. |
Booking Slots
The Booking Slots API allows you to query booking product slots.
Booking Slot properties
Attribute | Type | Description |
---|---|---|
product_id |
integer | Unique identifier for the product linked to the booking slot. read-only |
date |
date-time | The date-time of the booking slot. read-only |
duration |
integer | The duration of the booking slot. read-only |
available |
integer | Availability of the booking slot(1 or 0).read-only |
booked |
integer | Booking slot is already booked(1 or 0).read-only |
List all booking product slots
This API helps you to view booking product slots via query arguments.
HTTP request
/wp-json/wc-bookings/v1/products/slots
curl https://example.com/wp-json/wc-bookings/v1/products/slots?min_date=2020-04-20&max_date=2020-05-01&product_ids=655 \
-u consumer_key:consumer_secret
JSON response example:
{
"records": [
{
"date": "2020-04-25T12:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-25T14:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-25T16:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-25T18:00",
"duration": 90,
"available": 0,
"booked": 1,
"product_id": 655
},
{
"date": "2020-04-25T18:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-25T20:00",
"duration": 90,
"available": 0,
"booked": 1,
"product_id": 655
},
{
"date": "2020-04-26T12:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-26T14:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-26T16:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
},
{
"date": "2020-04-26T18:00",
"duration": 90,
"available": 1,
"booked": 0,
"product_id": 655
}
],
"count": 12
}
Available parameters
Parameter | Type | Description |
---|---|---|
min_date |
string | Set a minimum start date for booking slots retrieval. |
max_date |
string | Set a max start date for booking slots retrieval. mandatory |
product_ids |
integer | Comma-separated list of product ids to search. |
resource_ids |
integer | Comma-separated list of resource ids to search. |
page |
integer | Current page of the collection. Default is 1 . |
per_page |
integer | Maximum number of items to be returned in result set. Default is 10 . |
search |
string | Limit results to those matching a string. |
offset |
integer | Offset the result set by a specific number of items. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc . Default is asc . |