doc.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. The Kurz Web API exposes these routes:
  3. - GET "/<short>" : resolve a short URL
  4. - Handler: HandleGetShort()
  5. - Success: 307 to matching target URL
  6. - Client request incorrect: 400
  7. - Short not yet defined: 404 no matching target
  8. - Target blocked for permission reasons: 403
  9. - Target legally censored: 451
  10. - Server failure: 50*
  11. - POST "/" with <target>: create a short URL from a target URL
  12. - Handler: HandlePostTarget()
  13. - Success: 201 with <new short>
  14. - Already existing short: 409 with <existing short>
  15. - Target blocked for permission reasons: 403
  16. - Target legally censored: 451
  17. - Server failure: 50*
  18. Code 451 MAY be replaced by 403, for example when legal censorship includes a
  19. gag order, super-injunction (UK), National security letter (US) or similar
  20. mechanisms.
  21. */
  22. package api
  23. // Short is the type of responses provided by the Web API from a target.
  24. type Short struct {
  25. Short string `json:"short"`
  26. }
  27. // Target is the type of requests accepted by the Web API for target submissions.
  28. type Target struct {
  29. Target string `json:"target"`
  30. }