Returns short url for given long one
-
URL
:9090/post
-
Method:
POST
-
Data Params
your_long_url: string
-
Success Response:
- Code: 200
Body:short_url: string
- Code: 200
-
Error Response:
- Code: 400 StatusBadRequest
Possible reason:incorrect body
OR
- Code: 500 StatusInternalServerError
Possible reason:server has no more short urls temporally
- Code: 400 StatusBadRequest
-
Sample Call:
curl --location 'http://127.0.0.1:9090/post' \ --header 'Content-Type: text/plain' \ --data 'http://gmail.com'
Returns long url for given short one
-
URL
:9091/*
-
Method:
GET
-
Required param:
short_url=[string]
-
Success Response:
- Code: 301 StatusMovedPermanently
Location:long_url: string
- Code: 301 StatusMovedPermanently
-
Error Response:
- Code: 404 StatusNotFound
Possible reason:incorrect or not found url
OR
- Code: 503 StatusServiceUnavailable
Possible reason:server is too busy
OR
- Code: 500 StatusInternalServerError
Possible reason:smth went wrong
- Code: 404 StatusNotFound
-
Sample Call:
curl --location 'http://127.0.0.1:9091/4xabacaba'
$ docker compose build ; to build images
$ docker compose -p url_shorterer up ; to run docker compose - may be slow as it use kafka
$ docker compose -p url_shorterer down ; to stop all containers
Sequence diargams