Rest API

API contract

Long to short url

Request payload

  • Post https://tinyurl.com/

data:
{
    original_url: xxxx,
    expired_date: xxxx, 
    ip: xxxx
}

Response code

  • 200

Short to long url

Request payload

  • Get https://tinyurl.com/xxxxx

Response code 301 vs 302

  • 301: Permanent redirection.

  • 302: Temporarily moved.

  • Comparison:

    • Using a 302 response code, each time calling https://tinyurl.com/{shortened_Url} will call the server. It adds to the server load. However, if statistics about the short url is needed, then 301 will be better.

API implementation (Base62 with globalId)

Last updated

Was this helpful?