You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,24 @@
2
2
3
3
Official repository for the documentation of the [WooCommerce Memberships](https://woocommerce.com/products/woocommerce-memberships/) REST API.
4
4
5
-
If you are looking for the general plugin documentation, [please follow this link](https://docs.woocommerce.com/document/woocommerce-memberships/).
5
+
> If you are looking for the general **plugin documentation**, [please follow this link](https://docs.woocommerce.com/document/woocommerce-memberships/).
6
6
7
-
###Contributing
7
+
## Contributing
8
8
9
9
You can contribute to this documentation by:
10
10
11
-
*[Opening an issue](https://github.com/skyverge/woocommerce-memberships-rest-api-docs/issues/new) to report a problem or an information missing, etc.
11
+
*[Opening an issue](https://github.com/skyverge/woocommerce-memberships-rest-api-docs/issues/new) to report a problem or information missing, etc.
12
12
* Opening a pull request to extend the documentation.
13
13
14
-
Please **do not submit feature requests for the REST API** here. You can use the [WooIdeas board](http://ideas.woocommerce.com/forums/133476-woocommerce?category_id=125014) or [Contact SkyVerge support](https://www.skyverge.com/support/) for that.
14
+
> Please **do not submit feature requests or support requests for the REST API** here. You can use the [WooIdeas board](http://ideas.woocommerce.com/forums/133476-woocommerce?category_id=125014) or [Contact SkyVerge support](https://www.skyverge.com/support/).
15
15
16
-
###Updating pages
16
+
## Updating pages
17
17
18
18
This project uses [Slate](https://github.com/lord/slate) for building the documentation pages.
19
19
20
20
Follow [Slate readme](https://github.com/lord/slate/blob/master/README.md) and [wiki](https://github.com/lord/slate/wiki) for instructions on how to edit files and make changes.
A user membership is created when a customer gets access to a membership plan, therefore all user memberships are linked to one user and one membership plan only. Also, a membership has a status and a start date.
55
+
56
+
### Data Structure
57
+
58
+
A user membership has the following data structure in the REST API:
`id` | <code>int</code> | The unique identifier (integer) of the user membership.
63
+
`customer_id` | <code>int</code> | The unique identifier (integer) of the customer that owns the membership.
64
+
`plan_id` | <code>int</code> | The unique identifier (integer) of the membership plan the membership is for.
65
+
`status` | <code>string</code> | The current status (string) of the user membership.
66
+
`order_id` | <code>int|null</code> | The unique identifier (integer) of the order that may have granted access to the matching membership plan. If the user membership is not linked to an order, it will return _`null`_.
67
+
`subcription_id` | <code>int|null</code> | The unique identifier (integer) of a subscription that may be linked to the user membership. This property will exist only if the site is running WooCommerce Subscriptions alongside with Memberships. If there is no link to a subscription, the value will be _`null`_.
68
+
`product_id` | <code>int|null</code> | The unique identifier (integer) of a product that may have granted access to the matching membership plan. If the user membership is not linked to a product, it will return _`null`_.
69
+
`date_created` | <code>datetime</code> | The date (in Atom format) when the user membership object was created, in the local timezone. This does not necessarily match with the start date.
70
+
`date_created_gmt` | <code>datetime</code> | The date (in Atom format) when the user membership object was created, in UTC. This does not necessarily match with the start date.
71
+
`start_date` | <code>datetime</code> | The date (in Atom format) when the membership starts, in the local timezone.
72
+
`start_date_gmt` | <code>datetime</code> | The date (in Atom format) when the membership starts, in UTC.
73
+
`end_date` | <code>datetime|null</code> | The date (in Atom format) when the ends, in the local timezone. This is `null` if the membership doesn't have an end date.
74
+
`end_date_gmt` | <code>datetime|null</code> | The date (in Atom format) when the ends, in UTC. This is `null` if the membership doesn't have an end date.
75
+
`paused_date` | <code>datetime|null</code> | The date (in Atom format) when the membership was last paused, in the local timezone. This is `null` if the membership was never paused. The value is not removed if the membership changes status.
76
+
`paused_date_gmt` | <code>datetime|null</code> | The date (in Atom format) when the membership was last paused, in UTC. This is `null` if the membership was never paused. The value is not removed if the membership changes status.
77
+
`cancelled_date` | <code>datetime|null</code> | The date (in Atom format) when the membership was cancelled, in the local timezone. This is `null` if the membership was not cancelled.
78
+
`cancelled_date_gmt` | <code>datetime|null</code> | The date (in Atom format) when the membership was cancelled, in UTC. This is `null` if the membership was not cancelled.
79
+
`meta_data` | <code>array</code> | Holds any WordPress meta data set on the membership. Each array item has an `id` (integer), a `key` (string) and a `value` (either a boolean, an integer, or string, or serialized data).
80
+
`links` | <code>array</code> | An array of items linking to related objects accessible through the REST API.
81
+
82
+
## Get All User Memberships
51
83
52
84
```php
53
85
// TODO
@@ -100,6 +132,8 @@ This endpoint lists all routes, along with supported HTTP methods for each, made
100
132
]
101
133
```
102
134
135
+
**`memberships/members`**
136
+
103
137
This endpoint retrieves all user memberships.
104
138
105
139
### HTTP Request
@@ -108,7 +142,7 @@ This endpoint retrieves all user memberships.
`customer` | <code>int|string</code> | _`null`_ | List user memberships belonging to a specific user, specified by ID (integer), email address or login name (string).
114
148
`order` | <code>int</code> | _`null`_ | List user memberships created from a specific order, given by its ID (integer).
`page` | <code>int</code> | `1` | Main pagination parameter (integer). Only a given number of user memberships will be listed at any time, per page, according to the site settings.
125
159
`per_page` | <code>int</code> | _`null`_ | The default number of results to return per page. The default value is normally set by WordPress own settings.
`include` | <code>int|int[]</code> | _`null`_ | Ensure that the specified user memberships with given ID (integer) or IDs (array of integers) will be included in the results, if found.
This endpoint retrieves a specific user membership.
184
220
185
221
### HTTP Request
@@ -188,14 +224,46 @@ This endpoint retrieves a specific user membership.
188
224
189
225
### URL Parameters
190
226
191
-
Parameter | Value | Description
227
+
Parameter | Type | Description
192
228
--------- | ----------------- | ------------
193
229
`id` | <code>int</code> | Integer matching the requested user membership ID.
194
230
195
-
196
231
# Membership Plans
197
232
198
-
## Get Membership Plans
233
+
## The Membership Plan
234
+
235
+
A membership plan is a collection of settings and conditions according to which customers can get access to restricted content, products, get member only discounts and so on.
236
+
237
+
### Data Structure
238
+
239
+
A membership plan has the following data structure in the REST API:
`id` | <code>int</code> | The unique identifier (integer) of the membership plan.
244
+
`name` | <code>string</code> | The membership plan name.
245
+
`slug` | <code>string</code> | The membership plan slug (a unique string identifier).
246
+
`status` | <code>string</code> | The membership plan status (this usually matches standard WordPress post statuses, with `publish` or `draft` being the most common for plans).
247
+
`access_method` | <code>string</code> | The method that membership plan prescribes for users to gain access.
248
+
`access_length_type` | <code>string</code> | The access length type: specific (relative dates), fixed (fixed dates) or unlimited.
249
+
`access_length` | <code>string</code> | The length in a human readable format (e.g. 2 weeks or 3 months, 1 year, etc.) that a user membership created for this plan will have, by default. This could be an empty string for unlimited memberships that have no set end (or may be tied to a subscription).
250
+
`access_length_seconds` | <code>int|null</code> | The equivalent in seconds of the access length, calculated by approximation in the site timezone. If the access length is nto set this will return _`null`_.
251
+
`access_length_seconds_gmt` | <code>int|null</code> | The equivalent in seconds of the access length, calculated by approximation in UTC. If the access length is nto set this will return _`null`_.
252
+
`access_product_ids` | <code>int[]</code> | An optional array of product IDs (integers) to products that will grant access to the membership plan upon purchase. If no products grant access to the membership plan, the value will be an empty array.
253
+
`is_subscription_plan` | <code>bool</code> | Whether the plan has at least one subscription among the products that can grant access. If Subscriptions is inactive this field will not exist.
254
+
`is_subscription_installment_plan` | <code>bool</code> | Whether the plan uses the subscription for managing installment plans (the membership plan length is not directly tied to the subscription length). If Subscription is inactive this field will not exist.
255
+
`access_start_date` | <code>datetime</code> | If the plan length type is based on fixed dates, this will be the date when any user membership will start, otherwise it will default to now, in the local timezone and in Atom format.
256
+
`access_start_date_gmt` | <code>datetime</code> | If the plan length type is based on fixed dates, this will be the date when any user membership will start, otherwise it will default to now, in the UTC and in Atom format.
257
+
`access_end_date` | <code>datetime</code> | If the plan length type is fixed this will be a fixed date when any membership will end, otherwise it will be a date calculated relatively to now, in the local timezone and in Atom format.
258
+
`access_end_date_gmt` | <code>datetime</code> | If the plan length type is fixed this will be a fixed date when any membership will end, otherwise it will be a date calculated relatively to now, in UTC and in Atom format.
259
+
`date_created` | <code>datetime</code> | The date (in Atom format) when the membership plan object was created, in the local timezone.
260
+
`date_created_gmt` | <code>datetime</code> | The date (in Atom format) when the membership plan object was created, in UTC.
261
+
`date_modified` | <code>datetime</code> | The date (in Atom format) when the membership plan object was last modified, in the local timezone.
262
+
`date_modified_gmt` | <code>datetime</code> | The date (in Atom format) when the membership plan object was last modified, in UTC.
263
+
`meta_data` | <code>array</code> | Holds any WordPress meta data set on the plan. Each array item has an `id` (integer), a `key` (string) and a `value` (either a boolean, an integer, or string, or serialized data).
264
+
`links` | <code>array</code> | An array of items linking to related objects accessible through the REST API.
265
+
266
+
## Get All Membership Plans
199
267
200
268
```php
201
269
// TODO
@@ -256,6 +324,8 @@ Parameter | Value | Description
`exclude` | <code>int|int[]</code> | _`null`_ | Ensure that the specified membership plans with given ID (integer) or IDs (array of integers) will be excluded from the results, if found.
279
349
`include` | <code>int|int[]</code> | _`null`_ | Ensure that the specified membership plans with given ID (integer) or IDs (array of integers) will be included in the results, if found.
0 commit comments