Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates based on issues in the WooCommerce repo #243

Merged
merged 9 commits into from
Jul 17, 2024
4 changes: 2 additions & 2 deletions source/includes/wp-api-v3/_coupons.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ woocommerce.get("coupons").parsed_response
#### 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`. |
Expand All @@ -407,7 +407,7 @@ woocommerce.get("coupons").parsed_response
| `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`. |
| `orderby` | string | Sort collection by object attribute. Options: `date`, `modified`, `id`, `include`, `title` and `slug`. Default is `date`. |
| `code` | string | Limit result set to resources with a specific code. |

## Update a coupon ##
Expand Down
92 changes: 74 additions & 18 deletions source/includes/wp-api-v3/_order-refunds.md

Large diffs are not rendered by default.

129 changes: 58 additions & 71 deletions source/includes/wp-api-v3/_orders.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/includes/wp-api-v3/_product-variations.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ woocommerce.get("products/22/variations").parsed_response
| `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`. |
| `orderby` | string | Sort collection by object attribute. Options: `date`, `modified`, `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. |
Expand Down
90 changes: 45 additions & 45 deletions source/includes/wp-api-v3/_products.md

Large diffs are not rendered by default.

158 changes: 158 additions & 0 deletions source/includes/wp-api-v3/_refunds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Refunds #

The refunds API is a simple, read-only endpoint that allows you to retrieve a list of refunds outside the context of an existing order. To create, view, and delete individual refunds, check out the [order refunds API](#order-refunds).

## Refund properties ##

All properties are the same as those in the [order refunds endpoint](#order-refund-properties), but with one additional property:

| Attribute | Type | Description |
|-------------|---------|----------------------------------------------------|
| `parent_id` | integer | The ID of the order the refund is associated with. |

## Retrieve a list of refunds ##

This API lets you retrieve and view refunds from your store, regardless of which order they are associated with.

### HTTP request ###

<div class="api-endpoint">
<div class="endpoint-data">
<i class="label label-get">GET</i>
<h6>/wp-json/wc/v3/refunds</h6>
</div>
</div>

```shell
curl https://example.com/wp-json/wc/v3/refunds \
-u consumer_key:consumer_secret
```

```javascript
WooCommerce.get("refunds")
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.log(error.response.data);
});
```

```php
<?php print_r($woocommerce->get('refunds')); ?>
```

```python
print(wcapi.get("refunds").json())
```

```ruby
woocommerce.get("refunds").parsed_response
```

> JSON response example:

```json
[
{
"id": 726,
"parent_id": 124,
"date_created": "2017-03-21T17:07:11",
"date_created_gmt": "2017-03-21T20:07:11",
"amount": "10.00",
"reason": "",
"refunded_by": 1,
"refunded_payment": false,
"meta_data": [],
"line_items": [],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723/refunds/726"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723/refunds"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723"
}
]
}
},
{
"id": 724,
"parent_id": 63,
"date_created": "2017-03-21T16:55:37",
"date_created_gmt": "2017-03-21T19:55:37",
"amount": "9.00",
"reason": "",
"refunded_by": 1,
"refunded_payment": false,
"meta_data": [],
"line_items": [
{
"id": 314,
"name": "Woo Album #2",
"product_id": 87,
"variation_id": 0,
"quantity": -1,
"tax_class": "",
"subtotal": "-9.00",
"subtotal_tax": "0.00",
"total": "-9.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [
{
"id": 2076,
"key": "_refunded_item_id",
"value": "311"
}
],
"sku": "",
"price": -9
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723/refunds/724"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723/refunds"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/723"
}
]
}
}
]
```

#### 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. |
| `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`, `modified`, `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. |
| `dp` | integer | Number of decimal points to use in each resource. Default is `2`. |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: should we perhaps use the full name decimal_points instead of the abbreviation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we perhaps use the full name decimal_points instead of the abbreviation here?

dp is the name of the parameter used in the REST API, so if we changed it in the docs, we'd need to update the endpoint as well. Replacing dp with decimal_points would be backwards-incompatible, but I guess we could add decimal_points as an alias of dp.

I agree decimal_points would have been a better name from the start, though. For now I think we should keep the docs and the endpoint as they are.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree decimal_points would have been a better name from the start, though. For now I think we should keep the docs and the endpoint as they are.

👍

62 changes: 31 additions & 31 deletions source/includes/wp-api-v3/_system-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,38 @@ The system status API allows you to view all system status items.

### System status - Environment properties ###

| Attribute | Type | Description |
| --------------------------- | ------- | -------------------------------------------------------------------------- |
| `home_url` | string | Home URL. <i class="label label-info">read-only</i> |
| `site_url` | string | Site URL. <i class="label label-info">read-only</i> |
| `wc_version` | string | WooCommerce version. <i class="label label-info">read-only</i> |
| `log_directory` | string | Log directory. <i class="label label-info">read-only</i> |
| `log_directory_writable` | boolean | Is log directory writable? <i class="label label-info">read-only</i> |
| `wp_version` | string | WordPress version. <i class="label label-info">read-only</i> |
| `wp_multisite` | boolean | Is WordPress multisite? <i class="label label-info">read-only</i> |
| `wp_memory_limit` | integer | WordPress memory limit. <i class="label label-info">read-only</i> |
| `wp_debug_mode` | boolean | Is WordPress debug mode active? <i class="label label-info">read-only</i> |
| `wp_cron` | boolean | Are WordPress cron jobs enabled? <i class="label label-info">read-only</i> |
| `language` | string | WordPress language. <i class="label label-info">read-only</i> |
| `server_info` | string | Server info. <i class="label label-info">read-only</i> |
| `php_version` | string | PHP version. <i class="label label-info">read-only</i> |
| `php_post_max_size` | integer | PHP post max size. <i class="label label-info">read-only</i> |
| `php_max_execution_time` | integer | PHP max execution time. <i class="label label-info">read-only</i> |
| `php_max_input_vars` | integer | PHP max input vars. <i class="label label-info">read-only</i> |
| `curl_version` | string | cURL version. <i class="label label-info">read-only</i> |
| `suhosin_installed` | boolean | Is SUHOSIN installed? <i class="label label-info">read-only</i> |
| `max_upload_size` | integer | Max upload size. <i class="label label-info">read-only</i> |
| `mysql_version` | string | MySQL version. <i class="label label-info">read-only</i> |
| `default_timezone` | string | Default timezone. <i class="label label-info">read-only</i> |
| Attribute | Type | Description |
| ------------------------ | ------- | -------------------------------------------------------------------------- |
| `home_url` | string | Home URL. <i class="label label-info">read-only</i> |
| `site_url` | string | Site URL. <i class="label label-info">read-only</i> |
| `version` | string | WooCommerce version. <i class="label label-info">read-only</i> |
| `log_directory` | string | Log directory. <i class="label label-info">read-only</i> |
| `log_directory_writable` | boolean | Is log directory writable? <i class="label label-info">read-only</i> |
| `wp_version` | string | WordPress version. <i class="label label-info">read-only</i> |
| `wp_multisite` | boolean | Is WordPress multisite? <i class="label label-info">read-only</i> |
| `wp_memory_limit` | integer | WordPress memory limit. <i class="label label-info">read-only</i> |
| `wp_debug_mode` | boolean | Is WordPress debug mode active? <i class="label label-info">read-only</i> |
| `wp_cron` | boolean | Are WordPress cron jobs enabled? <i class="label label-info">read-only</i> |
| `language` | string | WordPress language. <i class="label label-info">read-only</i> |
| `server_info` | string | Server info. <i class="label label-info">read-only</i> |
| `php_version` | string | PHP version. <i class="label label-info">read-only</i> |
| `php_post_max_size` | integer | PHP post max size. <i class="label label-info">read-only</i> |
| `php_max_execution_time` | integer | PHP max execution time. <i class="label label-info">read-only</i> |
| `php_max_input_vars` | integer | PHP max input vars. <i class="label label-info">read-only</i> |
| `curl_version` | string | cURL version. <i class="label label-info">read-only</i> |
| `suhosin_installed` | boolean | Is SUHOSIN installed? <i class="label label-info">read-only</i> |
| `max_upload_size` | integer | Max upload size. <i class="label label-info">read-only</i> |
| `mysql_version` | string | MySQL version. <i class="label label-info">read-only</i> |
| `default_timezone` | string | Default timezone. <i class="label label-info">read-only</i> |
| `fsockopen_or_curl_enabled` | boolean | Is fsockopen/cURL enabled? <i class="label label-info">read-only</i> |
| `soapclient_enabled` | boolean | Is SoapClient class enabled? <i class="label label-info">read-only</i> |
| `domdocument_enabled` | boolean | Is DomDocument class enabled? <i class="label label-info">read-only</i> |
| `gzip_enabled` | boolean | Is GZip enabled? <i class="label label-info">read-only</i> |
| `mbstring_enabled` | boolean | Is mbstring enabled? <i class="label label-info">read-only</i> |
| `remote_post_successful` | boolean | Remote POST successful? <i class="label label-info">read-only</i> |
| `remote_post_response` | string | Remote POST response. <i class="label label-info">read-only</i> |
| `remote_get_successful` | boolean | Remote GET successful? <i class="label label-info">read-only</i> |
| `remote_get_response` | string | Remote GET response. <i class="label label-info">read-only</i> |
| `soapclient_enabled` | boolean | Is SoapClient class enabled? <i class="label label-info">read-only</i> |
| `domdocument_enabled` | boolean | Is DomDocument class enabled? <i class="label label-info">read-only</i> |
| `gzip_enabled` | boolean | Is GZip enabled? <i class="label label-info">read-only</i> |
| `mbstring_enabled` | boolean | Is mbstring enabled? <i class="label label-info">read-only</i> |
| `remote_post_successful` | boolean | Remote POST successful? <i class="label label-info">read-only</i> |
| `remote_post_response` | string | Remote POST response. <i class="label label-info">read-only</i> |
| `remote_get_successful` | boolean | Remote GET successful? <i class="label label-info">read-only</i> |
| `remote_get_response` | string | Remote GET response. <i class="label label-info">read-only</i> |

### System status - Database properties ###

Expand Down
Loading