-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebHook Event Subscription #735
Comments
Thanks @RobPhippen. A couple thoughts:
|
@casualjim I know you looked into this previously, any thoughts on the proposal? |
I'm missing any indication how the actual callback URL is passed (or rather, which of the properties in the Subscription object is the callback URL). |
Hi @ePaul that's absolutely right - that would require either standardisation of the subscription API, or semantic tagging of the 'real world' subscription API. |
It was proposed that standalone callbacks could go into the 'components' section, see #560 |
Closing as #763 has been merged. |
Summary
This issue proposes a mechanism to allow an event subscription API to be associated with the stream of events that may occur as a 'side effect' of the subscription.
This is one of three items agreed to be split out from #716 (see this note).
Objective of the proposal
Background
Many SaaS systems provide some kind of event interface as core to their behaviour.
There are many approaches to implementing this. No single approach is as prevalent as JSON/HTTP APIs have become for service implementation however webhooks is significtly more common than any other single approach.
WebHooks
Webhooks are a convention of use of normal Web interfaces, typically using JSON/HTTP,
in which an
event subscriber
can register acallback URL
with anevent publisher
.When an event occurs, the
event publisher
invokes an HTTP method on that URL (TypicallyPOST
) to send the information related to the event.WebHooks in real life
Webhooks are not standardized nor formally specified, but are in common use in a substiantial
number of systems.
The lack of standardisation means that there is variation in each of the following
areas;
subscription API
is made available - many systems instead requireregistration via an administrative UI
subscription API
is available, its precise form varies between different systemscallback URL
to be registered for each event stream,while others support subscription to multiple event streams with a single
callback URL
The following conventions are commonly observed;
it is common for them to provide a parameter, or a data field within a parameter, as part of the
POSTed message that specifies which event has occurred.
Some mandate the use of HTTP POST, while others allow other HTTP methods to be selected as an option
Scope of this proposal
This proposal covers the particular case where
subscription API
is offered that allows acallback URL
to be registered, and which allows the event of interest to be specifiedThe proposal does not specify a standardised form for the subscription API. Instead, it enables a subscription API to be identified via the presence of the
x-event-streams
element, which models the event stream that occurs as a result of the subscription operation.Related Proposals
An additional proposal, #736, builds on this proposal to add a mechanism to discriminate between multiple logical event streams on the same physical callback address.
Proposed Swagger Syntax
New syntax elements
This proposal introduces a single new syntax element,
x-event-streams
.This is defined to be an array in which each element defines a single logical event stream.
The event stream is delivered to the
callback URL
registered against the subscription API.In the absence of #736, this array is constrained to contain only one element.
x-event-streams
contains the following elements;event-id
, a logical identifier for the eventdescription
, a textual description of the event streamparameters
, containing the definition of the event information that will be delivered to the callback URL. The definition of this field is identical to the normalparameters
field definition.Example
We have chosen to use Github as our example, since it has a well formed subscription API.
Please refer to the Github documentation on 'create a hook'
for further information on the API definition provided by Github for webhooks.
Please note that all elements beginning with
x-github
orx-hub
are part of the Github APIspecification, and do not form part of this proposal.
Finally, the Swagger below is not comprehensive - for example, not all objects are fully modeled.
The text was updated successfully, but these errors were encountered: