From 77e0e39708fcd0ae933fd7c6f960e32e861db4c6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 30 Oct 2019 14:21:23 -0400 Subject: [PATCH 1/2] Improved callback examples --- versions/3.0.3.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/versions/3.0.3.md b/versions/3.0.3.md index 055bc9dd66..cfb6756b2d 100644 --- a/versions/3.0.3.md +++ b/versions/3.0.3.md @@ -1891,13 +1891,13 @@ $request.body#/successUrls/2 | http://clientdomain.com/medium $response.header.Location | http://example.org/subscription/1 -##### Callback Object Example +##### Callback Object Examples -The following example shows a callback to the URL specified by the `id` and `email` property in the request body. +The following example uses the user provided `queryUrl` query string parameter to define the callback URL. ```yaml -myWebhook: - 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': +myCallback: + '{$request.query.queryUrl}': post: requestBody: description: Callback payload @@ -1907,9 +1907,25 @@ myWebhook: $ref: '#/components/schemas/SomePayload' responses: '200': - description: webhook successfully processed and no retries will be performed + description: callback successfully processed ``` +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. + +```yaml +transactionCallback: + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': + post: + requestBody: + description: Callback payload + content: + 'application/json': + schema: + $ref: '#/components/schemas/SomePayload' + responses: + '200': + description: callback successfully processed +``` #### Example Object From 6f23ae549a305980f7368c5525633b3cb6528769 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 27 Nov 2019 20:41:57 +0000 Subject: [PATCH 2/2] Update versions/3.0.3.md Co-Authored-By: Darrel --- versions/3.0.3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/3.0.3.md b/versions/3.0.3.md index cfb6756b2d..2998511121 100644 --- a/versions/3.0.3.md +++ b/versions/3.0.3.md @@ -1893,7 +1893,7 @@ $response.header.Location | http://example.org/subscription/1 ##### Callback Object Examples -The following example uses the user provided `queryUrl` query string parameter to define the callback URL. +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. ```yaml myCallback: