Skip to content

Commit 35b2403

Browse files
committed
Add the changes from OAI#2048 and signpost webhooks
1 parent 168b0ec commit 35b2403

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

versions/3.1.0.md

+24-6
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,8 @@ A map of possible out-of band callbacks related to the parent operation.
18451845
Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.
18461846
The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
18471847

1848+
To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oasWebhooks) field.
1849+
18481850
##### Patterned Fields
18491851
Field Pattern | Type | Description
18501852
---|:---:|---
@@ -1894,25 +1896,41 @@ $request.body#/successUrls/2 | https://clientdomain.com/medium
18941896
$response.header.Location | https://example.org/subscription/1
18951897

18961898

1897-
##### Callback Object Example
1899+
##### Callback Object Examples
18981900

1899-
The following example shows a callback to the URL specified by the `id` and `email` property in the request body.
1901+
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.
19001902

19011903
```yaml
1902-
myWebhook:
1903-
'https://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
1904+
myCallback:
1905+
'{$request.query.queryUrl}':
19041906
post:
19051907
requestBody:
19061908
description: Callback payload
1907-
content:
1909+
content:
19081910
'application/json':
19091911
schema:
19101912
$ref: '#/components/schemas/SomePayload'
19111913
responses:
19121914
'200':
1913-
description: webhook successfully processed and no retries will be performed
1915+
description: callback successfully processed
19141916
```
19151917

1918+
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.
1919+
1920+
```yaml
1921+
transactionCallback:
1922+
'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
1923+
post:
1924+
requestBody:
1925+
description: Callback payload
1926+
content:
1927+
'application/json':
1928+
schema:
1929+
$ref: '#/components/schemas/SomePayload'
1930+
responses:
1931+
'200':
1932+
description: callback successfully processed
1933+
```
19161934

19171935
#### <a name="exampleObject"></a>Example Object
19181936

0 commit comments

Comments
 (0)