Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a user-configurable HTTP callback service using a response filter


In this recipe, we will look at adding callbacks or webhooks into your API. Webhooks are a method of using custom callbacks to alter the behavior of a web application often in order to provide a capability to integrate two separate web applications. For instance, GitHub provides a webhook that will call a service you define anytime someone forks your code—you might take advantage of them by creating an API that receives notifications when someone forks your code. You provide the service that GitHub calls, and GitHub makes sure to call your service any time that happens.

Note

You can read more about this and the many other webhooks GitHub provides at https://developer.github.com/webhooks/.

We will be focusing how to get this going using filter attributes so that you are also able to control which of your web services allows these callbacks. This technique can be useful for developers writing APIs for longer-running tasks...