Skip to content

Commit 46aa652

Browse files
authored
Grammar/style updates
1 parent 38dd020 commit 46aa652

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/pages/webhooks/responses.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords:
77

88
# Webhook responses and logging
99

10-
Currently, Adobe Commerce webhooks only support responses in JSON format. The response may be a single operation or the array of operations which will be executed consequently.
10+
Currently, Adobe Commerce webhooks support responses in JSON format only. The response may be a single operation or an array of operations to be executed afterward.
1111
Each operation must contain some required fields based on the desired operation.
1212

1313
Exceptions and notices are logged in the `<installation_directory>/var/log/system.log` file.
@@ -16,19 +16,19 @@ Exceptions and notices are logged in the `<installation_directory>/var/log/syste
1616

1717
The endpoint is expected to return a `200` response and a JSON object or array of objects that indicates the result of the operation. Each operation object can contain the list of fields based on the operation (`op`) which should be performed.
1818

19-
At the moment Adobe Commerce webhooks support 5 different operations:
19+
Adobe Commerce webhooks support the following operations:
2020

21-
operation | Description
21+
Operation | Description
2222
--- | ---
23-
`success` | the process that triggered the original event continues without any changes.
24-
`exception` | causes Commerce to terminate the process that triggered the original event
25-
`add` | updates the arguments in the original events by adding data described in the operation
26-
`replace` | replaces the arguments values in the original events based based on the response
27-
`remove` | removes values or nodes from the arguments in the original event by provided path
23+
`success` | The process that triggered the original event continues without any changes.
24+
`exception` | Causes Commerce to terminate the process that triggered the original event.
25+
`add` | Updates the arguments in the original event by adding data described in the operation
26+
`replace` | Replaces argument values in the original event, based on the response.
27+
`remove` | Removes values or nodes from the arguments in the original event by the provided path
2828

2929
### Success operation
3030

31-
The `success` operation is returned in cases when changes are not needed and the process that triggered the original event continues without any changes.
31+
The `success` operation is returned when changes are not needed. The process that triggered the original event continues without any changes.
3232

3333
The response of a successful request is as follows:
3434

@@ -44,32 +44,32 @@ The `exception` operation causes Commerce to terminate the process that triggere
4444

4545
Field | Type | Description
4646
--- | --- | ---
47-
`op` | required | `exception`
48-
`class` | optional | specifies the exception class. If `class` is not set, the `\Magento\Framework\Exception\LocalizedException` will be thrown.
49-
`message` | optional | specifies the exception message. If this field is not explicitly set, then the message defined in the `fallbackErrorMessage` configuration field will be returned. If `fallbackErrorMessage` is not set, the system default error message will be shown.
47+
`op` | Required | Contains `exception`.
48+
`class` | Optional | Specifies the exception class. If `class` is not set, `\Magento\Framework\Exception\LocalizedException` will be thrown.
49+
`message` | Optional | Specifies the exception message. If this field is not explicitly set, then the message defined in the `fallbackErrorMessage` configuration field will be returned. If `fallbackErrorMessage` is not set, the system default error message will be returned.
5050

5151
If an error occurs, the response is similar to the following:
5252

5353
```json
5454
{
5555
"op": "exception",
5656
"class": "Path\\To\\Exception\\Class",
57-
"message": "The product can not be added to the cart as it is out of the stock"
57+
"message": "The product cannot be added to the cart because it is out of the stock"
5858
}
5959
```
6060

6161
### Add operation
6262

63-
The `add` operation causes Commerce to add provided `value` to the provided `path` to the triggered event arguments
63+
The `add` operation causes Commerce to add the provided `value` to the provided `path` to the triggered event arguments
6464

6565
Field | Type | Description
6666
--- |----------| ---
67-
`op` | required | `add`
68-
`path` | required | specifies the path at which the `value` should be added to the triggered event arguments
69-
`value` | required | specifies the value that should be added, can be as a single value or in the array format
70-
`instance` | optional | specifies the DataObject class name which should be created based on `value` and added to the provided `path`. Used for the cases when the object should be added in provided path.
67+
`op` | Required | Contains `add`.
68+
`path` | Required | Specifies the path at which the `value` should be added to the triggered event arguments.
69+
`value` | Required | Specifies the value to be added. This can be as a single value or in an array format.
70+
`instance` | Optional | Specifies the `DataObject` class name to create, based on the `value` and added to the provided `path`. Use this field for cases when the object should be added in provided path.
7171

72-
For example, we want to add a new shipping method to the triggered event result payload:
72+
For example, we want to add a new shipping method to the triggered event result payload.
7373
The result is an array of `Magento\Quote\Model\Cart\ShippingMethod` objects:
7474

7575
```php
@@ -97,7 +97,7 @@ To add a new shipping method to that result, the response from the webhook would
9797
}
9898
```
9999

100-
Based on this operation the new instance of `Magento\Quote\Model\Cart\ShippingMethodInterface` will be created and added to the result array of shipping methods.
100+
Based on this operation, the new instance of `Magento\Quote\Model\Cart\ShippingMethodInterface` will be created and added to the result array of shipping methods.
101101

102102
```php
103103
$result = [
@@ -109,16 +109,16 @@ $result = [
109109

110110
### Replace operation
111111

112-
The `replaces` operation causes Commerce to replace a value in triggered event arguments for the provided `path`
112+
The `replace` operation causes Commerce to replace a value in triggered event arguments for the provided `path`
113113

114114
Field | Type | Description
115115
--- |----------| ---
116-
`op` | required | `replace`
117-
`path` | required | specifies the path at which the value should be replaced with the provided `value`
118-
`value` | required | specifies the new value that replaces the value by provided `path`, can be as a single or in the array format
119-
`instance` | optional | specifies the DataObject class name which should be created based on `value` and used as value to replaced by path `path`.
116+
`op` | Required | Contains `replace`.
117+
`path` | Required | Specifies the path at which the value should be replaced with the provided `value`.
118+
`value` | Required | Specifies the replacement value. This can be as a single value or in an array format.
119+
`instance` | Optional | Specifies the `DataObject` class name to create, based on the `value` and added to the provided `path`.
120120

121-
For example, we want to a replace a nested element in the triggered event result payload:
121+
The following example replaces a nested element in the triggered event result payload:
122122

123123
```php
124124
$result = [
@@ -158,10 +158,10 @@ The `remove` operation causes Commerce to remove a value or node in triggered ev
158158

159159
Field | Type | Description
160160
--- |----------| ---
161-
`op` | required | `remove`
162-
`path` | required | specifies the path at which the value should be removed
161+
`op` | Required | Contains `remove`.
162+
`path` | Required | Specifies the path at which the value should be removed.
163163

164-
For example, we want to a remove en element `key2` from the triggered event result payload:
164+
The following example removes element `key2` from the triggered event result payload:
165165

166166
```php
167167
$result = [

0 commit comments

Comments
 (0)