Skip to content

Commit 104b349

Browse files
authored
Merge pull request #2048 from philsturgeon/improved-callback-examples
Improved callback examples
2 parents 67975ba + 6f23ae5 commit 104b349

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

versions/3.0.3.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -1891,13 +1891,13 @@ $request.body#/successUrls/2 | http://clientdomain.com/medium
18911891
$response.header.Location | http://example.org/subscription/1
18921892

18931893

1894-
##### Callback Object Example
1894+
##### Callback Object Examples
18951895

1896-
The following example shows a callback to the URL specified by the `id` and `email` property in the request body.
1896+
The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
18971897

18981898
```yaml
1899-
myWebhook:
1900-
'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
1899+
myCallback:
1900+
'{$request.query.queryUrl}':
19011901
post:
19021902
requestBody:
19031903
description: Callback payload
@@ -1907,9 +1907,25 @@ myWebhook:
19071907
$ref: '#/components/schemas/SomePayload'
19081908
responses:
19091909
'200':
1910-
description: webhook successfully processed and no retries will be performed
1910+
description: callback successfully processed
19111911
```
19121912

1913+
The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.
1914+
1915+
```yaml
1916+
transactionCallback:
1917+
'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
1918+
post:
1919+
requestBody:
1920+
description: Callback payload
1921+
content:
1922+
'application/json':
1923+
schema:
1924+
$ref: '#/components/schemas/SomePayload'
1925+
responses:
1926+
'200':
1927+
description: callback successfully processed
1928+
```
19131929

19141930
#### <a name="exampleObject"></a>Example Object
19151931

0 commit comments

Comments
 (0)