Added API usage instructions
This commit is contained in:
47
assets/usage.html
Normal file
47
assets/usage.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>qurl.org - API usage</title>
|
||||
<style>
|
||||
body { font-size: 14px; }
|
||||
pre { font-size: 12px; border-left: 3px solid blue; padding-left: 10px; }
|
||||
ul { margin: 0px; padding: 0px; }
|
||||
li { margin: 0px 0px 0px 20px; padding: 0px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>API usage</h1>
|
||||
|
||||
<p>API URL: http://qurl.org/api/url</p>
|
||||
<p>
|
||||
<ul>Parameters (GET or POST)
|
||||
<li><b>url</b> The url to be shortened</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<ul>JSON Response
|
||||
<li><b>url</b> <i>(string)</i> the shortened url (e.g. http://qurl.org/0)</li>
|
||||
<li><b>exists</b> <i>(boolean)</i> true if the provided URL was already in the database</li>
|
||||
<li><b>error</b> <i>(string)</i> error message if url could not be shortened (e.g. "Invalid URL")</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h1>API example</h1>
|
||||
<p>
|
||||
<b>Submit:</b><pre>http://qurl.org/api/url?url=http://fark.com</pre>
|
||||
<b>Response:</b><pre>{"exists":true,"url":"http:\/\/qurl.org\/s"}</pre>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<b>Submit:</b><pre>http://qurl.org/api/url?url=http://klasjdlh.com</pre>
|
||||
<b>Response:</b><pre>{"exists":false,"url":"http:\/\/qurl.org\/Z1q"}</pre>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<b>Submit:</b><pre>http://qurl.org/api/url?url=notaurl</pre>
|
||||
<b>Response:</b><pre>{"error":"Not a valid URL."}</pre>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user