瀏覽代碼

Slightly improved API docs

trgwii 8 年之前
父節點
當前提交
f5e197fe20
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      README.md

+ 25 - 0
README.md

@@ -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