Skip to content

Commit 54ebcf4

Browse files
committed
Introduction text
1 parent 51b326e commit 54ebcf4

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

source/includes/wp-api-v1/_introduction.md

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Introduction #
22

3-
WooCommerce 2.6+ is fully integrated with the WordPress [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) API. This allows WooCommerce data to be created, read, updated, and deleted using requests in JSON format, and using WordPress REST API Authentication methods, and standard HTTP verbs, which are understood by most HTTP clients.
3+
WooCommerce (WC) 2.6+ is fully integrated with the WordPress [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) API. This allows WC data to be created, read, updated, and deleted using requests in JSON format and using WordPress REST API Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
44

5-
The current WP REST API integration version is `v1` which takes a first-order position in endpoints. The following table shows API versions present in each major version of WooCommerce:
5+
The following table shows API versions present in each major version of WooCommerce:
66

7-
| Version | WooCommerce Version | WordPress Version |
8-
|---------|---------------------|----------------------|
9-
| `v1` | 2.6.x | 4.4 or later |
7+
| API Version | WC Version | WP Version | Documentation |
8+
|-------------|------------|------------|---------------|
9+
| `v1` | 2.6.x or later | 4.4 or later |
10+
| `Legacy v3` | 2.4.x or later | 4.1 or later | [Legacy v3 docs](v3.html) |
11+
| `Legacy v2` | 2.2.x or later | 4.1 or later | [Legacy v2 docs](v2.html) |
12+
| `Legacy v1` | 2.1.x or later | 4.1 or later | [Legacy v1 docs](v1.html) |
13+
14+
The current WP REST API integration version is `v1` which takes a first-order position in endpoints.
15+
16+
Prior to 2.6, WooCommerce had it's own REST API separate from WordPress. The main differences between the new API and legacy API are that WordPress now handles authentication, there are new new formats and parameters for all objects, and we've adopted the use of schemas for all endpoints (accessed when doing OPTIONS requests).
1017

1118
## Requirements ##
1219

@@ -20,26 +27,9 @@ To use the latest version of the REST API you must be using:
2027
If you use ModSecurity and see `501 Method Not Implemented` errors, see [this issue](https://github.com/woothemes/woocommerce/issues/9838) for details.
2128

2229
<aside class="notice">
23-
Note that is <strong>NOT REQUIRED</strong> install the <a href="https://wordpress.org/plugins/rest-api/" target="_blank">WP REST API (WP API)</a> plugin.
30+
Please note that you are <strong>not</strong> required to install the <a href="https://wordpress.org/plugins/rest-api/" target="_blank">WP REST API (WP API)</a> plugin to use the WC REST API - the WC REST API runs independently.
2431
</aside>
2532

26-
## Legacy API ##
27-
28-
Prior to 2.6, WooCommerce had it's own REST API independent from WordPress. The differences between the new API and legacy API are as follows:
29-
30-
* In the new API, the WordPress REST API handles authentication instead of our API.
31-
* The WP REST API integration includes batch endpoints for coupons, customers, orders, refunds, products, attributes, categories, tags, taxes and webhooks.
32-
* New formats and parameters for coupons, orders, products and some taxomonies to reflect changes in the WooCommerce core.
33-
* We've adopted the use of schemas for all endpoints (accessed when doing OPTIONS requests).
34-
35-
Our API Keys, authentication endpoint and webhooks still work with the new API.
36-
37-
Documentation for the legacy APIs can be found below:
38-
39-
* [WooCommerce REST API v1 docs](v1.html)
40-
* [WooCommerce REST API v2 docs](v2.html)
41-
* [WooCommerce REST API v3 docs](v3.html)
42-
4333
## Request/Response Format ##
4434

4535
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.
@@ -78,10 +68,12 @@ curl https://example.com/wp-json/wc/v1/products/tags/34?_jsonp=tagDetails \
7868

7969
Occasionally you might encounter errors when accessing the REST API. There are four possible types:
8070

81-
* Invalid requests, such as using an unsupported HTTP method will result in `400 Bad Request`.
82-
* Authentication or permission errors, such as incorrect API keys will result in `401 Unauthorized`.
83-
* Requests to resources that don't exist or are missing required parameters will result in `404 Not Found`.
84-
* Requests that cannot be processed due to a server error will result in `500 Internal Server Error`.
71+
| Error Code | Error Type |
72+
|------------|------------|
73+
| `400 Bad Request` | Invalid request, e.g. using an unsupported HTTP method |
74+
| `401 Unauthorized` | Authentication or permission error, e.g. incorrect API keys |
75+
| `404 Not Found` | Requests to resources that don't exist or are missing |
76+
| `500 Internal Server Error` | Server error |
8577

8678
> WP REST API error example:
8779
@@ -140,8 +132,6 @@ Link: <https://www.example.com/wp-json/wc/v1/products?page=2>; rel="next",
140132
<https://www.example.com/wp-json/wc/v1/products?page=3>; rel="last"`
141133
```
142134

143-
*Linebreak included for readability*
144-
145135
The possible `rel` values are:
146136

147137
| Value | Description |

0 commit comments

Comments
 (0)