System.Web.Http.HttpConfigurationExtensions.InitializeReceiveMyGetWebHooks C# (CSharp) Method

InitializeReceiveMyGetWebHooks() public static method

Initializes support for receiving MyGet WebHooks. A sample WebHook URI is 'https://<host>/api/webhooks/incoming/myget/{id}?code=83699ec7c1d794c0c780e49a5c72972590571fd8'. For security reasons the WebHook URI must be an https URI and contain a 'code' query parameter with the same value as configured in the 'MS_WebHookReceiverSecret_MyGet' application setting. The 'code' parameter must be between 32 and 128 characters long. For details about MyGet WebHooks, see http://docs.myget.org/docs/reference/webhooks.
public static InitializeReceiveMyGetWebHooks ( this config ) : void
config this The current config.
return void
        public static void InitializeReceiveMyGetWebHooks(this HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            WebHooksConfig.Initialize(config);

            // Register media type with JSON formatter
            MediaTypeHeaderValue mediaType = MediaTypeHeaderValue.Parse(MyGetWebHookReceiver.MediaType);
            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(mediaType);
        }
    }