Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2016-02-12 18:38:58 +0300
committerChaoyi Zha <summermontreal@gmail.com>2016-02-12 18:38:58 +0300
commit76589f6aa76dd654bd94f9ea3023811da103b0d9 (patch)
tree2e914deec4f5a7a2f327bb0ee501542059a6ea60 /docs
parente25c5b1005d118afcf66ff8cb45421a331379595 (diff)
Add API implementation
Diffstat (limited to 'docs')
-rw-r--r--docs/developer-guide/api.md26
1 files changed, 19 insertions, 7 deletions
diff --git a/docs/developer-guide/api.md b/docs/developer-guide/api.md
index 3f0a837..06d72df 100644
--- a/docs/developer-guide/api.md
+++ b/docs/developer-guide/api.md
@@ -33,20 +33,28 @@ Example `json` responses:
```
{
"action": "shorten",
- "result": "https://PATHTOPOLR/5kq"
+ "result": "https://example.com/5kq"
}
```
```
{
- "action": "lookup",
- "result": "https://google.com"
+ "action":"lookup",
+ "result": {
+ "long_url": "https:\/\/google.com",
+ "created_at": {
+ "date":"2016-02-12 15:20:34.000000",
+ "timezone_type":3,
+ "timezone":"UTC"
+ },
+ "clicks":"0"
+ }
}
```
Example `plain_text` responses:
-```https://PATHTOPOLR/5kq```
+```https://example.com/5kq```
```https://google.com```
@@ -63,12 +71,12 @@ Arguments:
Response: A JSON or plain text representation of the shortened URL.
-Example: GET `http://PATHTOPOLR/api/v2/action/shorten?key=API_KEY_HERE&url=https://google.com&custom_ending=CUSTOM_ENDING&is_secret=false`
+Example: GET `http://example.com/api/v2/action/shorten?key=API_KEY_HERE&url=https://google.com&custom_ending=CUSTOM_ENDING&is_secret=false`
Response:
```
{
"action": "shorten",
- "result": "https://PATHTOPOLR/5kq"
+ "result": "https://example.com/5kq"
}
```
@@ -82,10 +90,11 @@ it does not exist, the API will return with the status code 404 (Not Found).
Arguments:
- `url_ending`: the link ending for the URL to look up. (e.g `5ga`)
+ - `url_key` (optional): optional URL ending key for lookups against secret URLs
Remember that the `url` argument must be URL encoded.
-Example: GET `http://PATHTOPOLR/api/v2/action/lookup?key=API_KEY_HERE&ending=2`
+Example: GET `http://example.com/api/v2/action/lookup?key=API_KEY_HERE&ending=2`
Response:
```
{
@@ -114,6 +123,9 @@ This status code is returned in the following circumstances:
- By any endpoint
- You are unauthorized to make the transaction. This is most likely due to an API token mismatch, or your API token has not be set to active.
+ - By the `lookup` endpoint
+ - You have not provided the valid `url_key` for a secret URL lookup.
+
### HTTP 404 Not Found