跳到主要内容
版本:1.0

API Reference

Use PatchPost’s public API to integrate patch notes into your own tools and workflows.

PatchPost provides a public REST API that allows external applications or scripts to interact with your patch notes. This is useful if you want to automate tasks or integrate PatchPost with other systems (for example, pulling your changelogs into a website or game launcher).

备注

This reference covers the public PatchPost API endpoints. Internal or private service APIs (used by PatchPost itself) are out of scope.

Authentication

To use the API, you first need to authenticate and obtain a user token. For example:

curl -X POST https://api.patchpost.crypticredhat.com/api/auth/user \
-H 'X-Api-Key: YOUR_KEY' \
-H 'X-Api-Secret: YOUR_SECRET'

The response will include a token. For all subsequent API requests, include this token in an Authorization: Bearer YOUR_TOKEN header, and also provide your Discord user ID in an X-Discord-UserId: YOUR_USER_ID header. Middleware validates this header and exposes the ID for permission checks.

Example: List Projects

Here’s an example API call to fetch the projects for a given Discord server (guild):

curl https://api.patchpost.crypticredhat.com/api/guilds/{guildId}/projects \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'X-Discord-UserId: YOUR_USER_ID'

This request returns a JSON list of projects associated with the specified server.

For a full list of available endpoints and more details, refer to the PatchPost API documentation.