a simple url shortener in Go (check it out at qurl.org)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>qurl.org - API usage</title>
  6. <style>
  7. body { font-size: 14px; }
  8. pre { font-size: 12px; border-left: 3px solid blue; padding-left: 10px; }
  9. ul { margin: 0px; padding: 0px; }
  10. li { margin: 0px 0px 0px 20px; padding: 0px; }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>API usage</h1>
  15. <p>API URL: http://qurl.org/api/url</p>
  16. <p>
  17. <ul>Parameters (GET or POST)
  18. <li><b>url</b> The url to be shortened</li>
  19. </ul>
  20. </p>
  21. <p>
  22. <ul>JSON Response
  23. <li><b>url</b> <i>(string)</i> the shortened url (e.g. http://qurl.org/0)</li>
  24. <li><b>exists</b> <i>(boolean)</i> true if the provided URL was already in the database</li>
  25. <li><b>error</b> <i>(string)</i> error message if url could not be shortened (e.g. "Invalid URL")</li>
  26. </ul>
  27. </p>
  28. <h1>API example</h1>
  29. <p>
  30. <b>Submit:</b><pre>http://qurl.org/api/url?url=http://fark.com</pre>
  31. <b>Response:</b><pre>{"exists":true,"url":"http:\/\/qurl.org\/s"}</pre>
  32. </p>
  33. <br/>
  34. <p>
  35. <b>Submit:</b><pre>http://qurl.org/api/url?url=http://klasjdlh.com</pre>
  36. <b>Response:</b><pre>{"exists":false,"url":"http:\/\/qurl.org\/Z1q"}</pre>
  37. </p>
  38. <br/>
  39. <p>
  40. <b>Submit:</b><pre>http://qurl.org/api/url?url=notaurl</pre>
  41. <b>Response:</b><pre>{"error":"Not a valid URL."}</pre>
  42. </p>
  43. </body>
  44. </html>