Skip to content

Define Hook

Furkan Güngör edited this page Jan 2, 2022 · 4 revisions

Usage

Get IHookService from Dependency Injection.

Add Hook

var hook = new Hook
{
    TenantId = "xx",
    Key = "hook.key",
    Name = "name of hook",
    HookRequests = new List<HookRequest>
    {
        new HookRequest
        {
            Url = "https://google.com/search?q=ironhook",
            MaxRetryCount = 3,
            NotifiyEmail = "[email protected]",
            Method = "GET",
            Headers = JsonSerializer.Serialize(new List<HeaderParameter>
            {
                new HeaderParameter
                {
                    Name = "Authorization",
                    Value = "Bearer xxx"
                },
                new HeaderParameter
                {
                    Name = "ApiKey",
                    Value = "xxxxx"
                },
            })
        },
        new HookRequest
        {
            Url = "https://google.com/search?q=github",
            MaxRetryCount = 4,
            NotifiyEmail = "[email protected]",
            Method = "GET",
            Headers = JsonSerializer.Serialize(new List<HeaderParameter>
            {
                new HeaderParameter
                {
                    Name = "Authorization",
                    Value = "Bearer xxx"
                }
            })
        }
    }
};

await hookService.AddAsync(hook);

Swagger SS

image

Next Page

Clone this wiki locally