URLs

URL resources.

GET /{id}

Redirect to the original (long) URL.

  • Parameters
  • id
    string The id of the URL.
  • Requests SHOW
  • > Accept: text/html
  • Response 302 SHOW
  • < Content-Type: text/html
    < Location: http://original.url
    <a href="http://original.url">Found</a>.
    
GET /{id}

Return the URL resource as JSON

  • Parameters
  • id
    string The id of the URL.
  • Requests SHOW
  • > Accept: application/json
  • Response 200 SHOW
  • < Content-Type: application/json
    {
      "Id": "1",
      "LongUrl": "http://original.url"
    }
    
POST /

Shorten a URL with a JSON POST request

  • Requests SHOW
  • > Accept: application/json
    {
      "url": "http://original.url"
    }
    
  • Response 201 SHOW
  • < Content-Type: application/json
    {
      "Id": "1",
      "LongUrl": "http://original.url"
    }