Slightly improved API docs

This commit is contained in:
trgwii 2018-02-13 15:31:53 +01:00 committed by GitHub
parent 03cee6b8df
commit f5e197fe20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -53,8 +53,23 @@ You need to have [Node.js](https://nodejs.org/) and [Neo4j](https://neo4j.com/)
## API
In additional to website, you can use these APIs to create, delete and get URLs.
### Types
```
URL {
createdAt {string} ISO timestamp of when the URL was created
id {string} Unique ID of the URL
target {string} Where the URL will redirect to
password {boolean} Whether or not a password is required
count {number} The amount of visits to this URL
shortUrl {string} The shortened link (Usually https://kutt.it/id)
}
```
In order to use these APIs you need to generate an API key from settings. Don not ever put this key in the client side of your app or anywhere that is exposed to others.
All API requests and responses are in JSON format.
Include API key as `apikey` in the body of all below requests. Available API URLs with body parameters:
**Get shortened URLs list:**
@ -62,6 +77,14 @@ Include API key as `apikey` in the body of all below requests. Available API URL
POST /api/url/geturls
```
Returns:
```
{
list {Array<URL>} List of URL objects
countAll {number} Amount of items in the list
}
```
**Submit a links to be shortened**:
```
POST /api/url/submit
@ -69,6 +92,8 @@ POST /api/url/submit
Body:
* `target`: Original long URL to be shortened.
Returns: URL object
**Delete a shortened URL** and **Get stats for a shortened URL:**
```
POST /api/url/deleteurl