Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<head>
<style>
table tr:nth-child(even) {
background-color: #eee;
}
table tr:nth-child(odd) {
background-color: #fff;
}
table th {
background-color: black;
color: white;
}
</style>
</head>
<body>
<h1>Docs for URL shorter API</h1>
{% if apikey %}
<p>You API key is: {{apikey}}</p>
{% endif %}
<h3>Make a request</h3>
<p>The usage of the API is very simple, you have to make a push request to {{domain}}/user/api which have to include the folowing Arguments:</p>
<ul>
<li>short: the short URL you want to get. example: {{domain}}/example</li>
<li>long: the long URL you want to short</li>
<li>apikey: you can add this argument, if you want to assign this link to your account.</li>
</ul>
<p>example API call with curl: <i>curl -d "apikey={{apikey}}&short={{domain}}/example&long=http://example.com" -X POST {{url_scheme}}://{{domain}}/user/api</i></p>
<h3>Responses from Server</h3>
<p>The response from the server is always made in json format it includes the following arguments:</p>
<ul>
<li>status: The status code of the reponse. Down there is a table with the posible response codes</li>
<li>message: This argument will do the same like the status code, but it is written out, for reading by human.</li>
</ul>
<h4>Response codes:</h4>
<table>
<tr>
<th>Code</th>
<th>Meaning</th>
</tr>
<tr>
<td>0</td>
<td>Success</td>
</tr>
<tr>
<td>1</td>
<td>The short URL argument is missing</td>
</tr>
<tr>
<td>2</td>
<td>The long URL is missing.</td>
</tr>
<tr>
<td>3</td>
<td>The doamin for the short URL is not in the list of allowed domains</td>
</tr>
<tr>
<td>4</td>
<td>The short URL is already taken.</td>
</tr>
</table>
</body>