100 lines
1.8 KiB
HTTP
100 lines
1.8 KiB
HTTP
@baseUrl = http://localhost:3000
|
|
@accessToken = {{login.response.body.accessToken}}
|
|
@shortId = {{shortenUrl.response.body.shortId}}
|
|
@urlId = {{shortenUrl.response.body.id}}
|
|
|
|
### Health Check
|
|
GET {{baseUrl}}/api/health HTTP/1.1
|
|
###
|
|
|
|
### Register a new user
|
|
POST {{baseUrl}}/api/auth/signup HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"email": "newuser@example.com",
|
|
"password": "securepassword",
|
|
"name": "New User"
|
|
}
|
|
###
|
|
|
|
# @name login
|
|
POST {{baseUrl}}/api/auth/login HTTP/1.1
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"email": "newuser@example.com",
|
|
"password": "securepassword"
|
|
}
|
|
###
|
|
|
|
### Get user information
|
|
GET {{baseUrl}}/api/user HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
###
|
|
|
|
### Update user profile
|
|
PATCH {{baseUrl}}/api/user HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "Updated User Name"
|
|
}
|
|
###
|
|
|
|
### Update user password
|
|
PATCH {{baseUrl}}/api/user/password HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"password": "newsecurepassword"
|
|
}
|
|
###
|
|
|
|
# @name shortenUrl
|
|
POST {{baseUrl}}/api/url/shorten HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"url": "http://example.com/some/long/path"
|
|
}
|
|
###
|
|
|
|
### Shorten URL with Alias
|
|
POST {{baseUrl}}/api/url/shorten HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"url": "http://example.com/another/path",
|
|
"alias": "myalias"
|
|
}
|
|
###
|
|
|
|
### Get user urls
|
|
GET {{baseUrl}}/api/url HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
###
|
|
|
|
### Update URL Alias
|
|
PATCH {{baseUrl}}/api/url/{{urlId}} HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"alias": "updatedalias"
|
|
}
|
|
###
|
|
|
|
### Delete a url
|
|
DELETE {{baseUrl}}/api/url/{{urlId}} HTTP/1.1
|
|
Authorization: Bearer {{accessToken}}
|
|
###
|
|
|
|
### Get a url redirection
|
|
GET {{baseUrl}}/{{shortId}} HTTP/1.1
|
|
###
|