Skip to content

Commit e36edb5

Browse files
authored
Merge pull request #13 from asynchronics/webhooks
initial webhook documentation
2 parents f6a4f59 + 4ed17f7 commit e36edb5

1 file changed

Lines changed: 68 additions & 1 deletion

File tree

src/views/DocumentationV5View.vue

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ import MainHeader from "../components/elements/MainHeader.vue";
105105
<li>
106106
<router-link to="#database">Database Backend</router-link>
107107
</li>
108+
<li>
109+
<router-link to="#webhooks">Webhooks</router-link>
110+
</li>
108111
</ul>
109112
</li>
110113
<li class="list-group-item">
@@ -456,7 +459,7 @@ helm uninstall kellnr</code></pre>
456459
<td>Requires fields to be defined on upload crates. Leave empty to not add restrictions. If set to
457460
e.g. ["authors", "repository"], all uploaded crates have to have the authors and repository defined
458461
in their Cargo.toml's.
459-
If used from an environment variable, the value has to be a comma separated list without spaces, e.g.
462+
If used from an environment variable, the value has to be a comma separated list without spaces, e.g.
460463
"authors,repository"
461464
</td>
462465
</tr>
@@ -732,6 +735,70 @@ helm uninstall kellnr</code></pre>
732735
create all tables and indexes automatically on first start.
733736
</TextBlock>
734737

738+
<SubHeader id="webhooks">Webhooks</SubHeader>
739+
<TextBlock>
740+
Kellnr offers a basic webhook functionality allowing callback notifications
741+
when crates are added or modified.<br /><br />
742+
Webhooks can be registered by admin users via API calls:
743+
</TextBlock>
744+
745+
<CodeBlock>
746+
<pre v-highlightjs><code class="bash">curl kellnr_url/api/v1/webhook -X POST \
747+
-H "Authorization: Bearer ADMIN-TOKEN" \
748+
-H "Content-Type: application/json" \
749+
-d '{
750+
"type": "crate_yank",
751+
"callback_url": "http://my-other-service:8000/crate-yank",
752+
"name": "My yank webhook"
753+
}'
754+
755+
# Successful response will contain registered webhook's id:
756+
{"id":"f9e8a090-7144-48ff-89d6-fa774d24f59b"}
757+
758+
# Sample payload sent after a yank event:
759+
{
760+
"data": { "crate_name": "test_crate", "crate_version": "0.1.2" },
761+
"timestamp": "2025-09-24T15:19:04.842575427Z",
762+
"type": "crate_yank"
763+
}</code></pre>
764+
</CodeBlock>
765+
766+
<TextBlock>
767+
Available event types are:
768+
<ul>
769+
<li><i>crate_add</i></li>
770+
<li><i>crate_update</i></li>
771+
<li><i>crate_yank</i></li>
772+
<li><i>crate_unyank</i></li>
773+
</ul>
774+
775+
Unsuccessful deliveries are retried in increasing time intervals, based on Github's guidelines:
776+
<a href="https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md#deliverability-and-reliability">
777+
https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md#deliverability-and-reliability
778+
</a>
779+
780+
<br /><br />
781+
Other administration tasks are also performed via API calls:
782+
</TextBlock>
783+
784+
<CodeBlock>
785+
<pre v-highlightjs><code class="bash"># View specific webhook
786+
curl kellnr_url/api/v1/webhook/f9e8a090-7144-48ff-89d6-fa774d24f59b \
787+
-X GET -H "Authorization: Bearer ADMIN-TOKEN"
788+
789+
# View all
790+
curl kellnr_url/api/v1/webhook -X GET -H "Authorization: Bearer ADMIN-TOKEN"
791+
792+
# Unregister a given webhook
793+
curl kellnr_url/api/v1/webhook/f9e8a090-7144-48ff-89d6-fa774d24f59b \
794+
-X DELETE -H "Authorization: Bearer ADMIN-TOKEN"
795+
796+
# Test a webhook (sends a dummy payload to the callback_url)
797+
curl kellnr_url/api/v1/webhook/f9e8a090-7144-48ff-89d6-fa774d24f59b/test \
798+
-X GET -H "Authorization: Bearer ADMIN-TOKEN"
799+
</code></pre>
800+
</CodeBlock>
801+
735802
<MainHeader id="configure-cargo">Configure Cargo</MainHeader>
736803
<TextBlock>
737804
Cargo needs to know about your Kellnr instance to be able to pull and publish crates from

0 commit comments

Comments
 (0)