Merge pull request #17 from tomcollis/issue-14
Add simple API documentation
This commit is contained in:
commit
9355ff5503
51
docs/api.md
Normal file
51
docs/api.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Sink API
|
||||
|
||||
Sink has a basic API implementation but it is not stable written yet.
|
||||
|
||||
## API Reference
|
||||
|
||||
### Create Short Link
|
||||
|
||||
```http
|
||||
POST /api/link/create
|
||||
```
|
||||
|
||||
| Header | Description |
|
||||
| :----- | :------------------------- |
|
||||
| `authorization` | `Bearer SinkCool` |
|
||||
| `content-type` | `application/json` |
|
||||
|
||||
|
||||
#### Example
|
||||
|
||||
```http
|
||||
POST /api/link/create
|
||||
HEADER authorization:Bearer SinkCool, content-type:application/json
|
||||
BODY {
|
||||
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||
"slug": issue14
|
||||
}
|
||||
```
|
||||
|
||||
The BODY data must be JSON.
|
||||
|
||||
```http
|
||||
RESPONSE 201
|
||||
BODY {
|
||||
"link": {
|
||||
"id": "xpqhaurv5q",
|
||||
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||
slug": "issue14",
|
||||
"createdAt": 1718119809,
|
||||
"updatedAt": 1718119809
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :-------- | :------- | :------------------------- |
|
||||
| `id` | `string` | This is automatically generated by Sink |
|
||||
| `url` | `string` | This is confirmation of the submitted URL and is required. |
|
||||
| `slug` | `string` | This is slug generated by the system, either automatically or from the input (if provided) |
|
||||
| `createdAt` | `timestamp` | This is automatically generated with a UNIX Timestamp. |
|
||||
| `updatedAt` | `timestamp` | This is automatically generated with a UNIX Timestamp. |
|
||||
Loading…
Reference in New Issue
Block a user