Add Callback[edit]

In OpenAPI 3 specs, you can define callbacks – asynchronous, out-of-band requests that your service will send to some other service in response to certain events. This helps you improve the workflow your API offers to clients. A typical example of a callback is subscription functionality – users subscribe to certain events of your service and receive a notification when this or that event occurs. For example, an e-shop can send a notification to the manager on each purchase. These notifications will be “out-of-band”, that is, they will go through a connection other than the connection through which a visitor works, and they will be asynchronous, as they will be out of the regular request-response flow. In OpenAPI 3, you can define the format of the “subscription” operation as well as the format of callback messages and expected responses to these messages. This description will simplify communication between different servers and will help you standardize the use of webhooks in your API.

Add Global Callback[edit]

To add a global callback, select the Paths tab at the bottom. Select the tab Global Callbacks then click the addition button (+) in the local (top-right) toolbar.

Oas3 add global callback.png

Add Method Callback[edit]

You can define a new callback or refer to an existing global one to use it within a method.

To add a callback, click the the addition button (+) or New Callback from the drop-down menu. To refer to a global one, select the Refer to Global Callback from the drop-down menu. Oas3 add callback.png

Add Callback Path[edit]

To add a callback path, click the Add Callback Path link from the local menu within the callbacks tab.

Oas3 add callback path.png

Delete Callback[edit]

To delete a callback, click the Delete link button from the local toolbar.

Oas3 delete callback.png

Add Callback Content and Response[edit]

Below the callback path, we specify the method of the callback message and define the message format and the expected responses. These definitions are similar to regular request and response definitions.

To add the callback method, right mouse click on the callback path, then select New Operation.

Oas3 callback method.png

Add Callback Method Request Body

To add the request body of the callback method, select the method, then select the Request Bodies tab.

Oas3 callback method request body.png

Add Callback Method Response

To add a response to some callback method, select the method, then select the responses tab.

Oas3 callback method response.png