Add an endpoint to view your own system

This commit is contained in:
Ske 2019-07-15 20:06:28 +02:00
parent cc31664f8b
commit 39152dbd27
2 changed files with 28 additions and 0 deletions

View File

@ -48,6 +48,13 @@ namespace PluralKit.API.Controllers
_auth = auth; _auth = auth;
} }
[HttpGet]
[RequiresSystem]
public async Task<ActionResult<PKSystem>> GetOwnSystem()
{
return Ok(_auth.CurrentSystem);
}
[HttpGet("{hid}")] [HttpGet("{hid}")]
public async Task<ActionResult<PKSystem>> GetSystem(string hid) public async Task<ActionResult<PKSystem>> GetSystem(string hid)
{ {

View File

@ -50,6 +50,27 @@ The following three models (usually represented in JSON format) represent the va
## Endpoints ## Endpoints
### `GET /s`
**Requires authentication.**
Returns information about your own system.
#### Example request
GET https://api.pluralkit.me/v1/s
#### Example response
```json
{
"id": "abcde",
"name": "My System",
"description": "This is my system description. Yay.",
"tag": "[MySys]",
"avatar_url": "https://path/to/avatar/image.png",
"tz": "Europe/Copenhagen",
"created": "2019-01-01T14:30:00.987654Z"
}
```
### `GET /s/<id>` ### `GET /s/<id>`
Queries a system by its 5-character ID, and returns information about it. If the system doesn't exist, returns `404 Not Found`. Queries a system by its 5-character ID, and returns information about it. If the system doesn't exist, returns `404 Not Found`.