ada endpoint yang bisa diakses tanpa autentikasi (tanpa login username dan password)
ada juga endpoint yang bisa diakses ole User yang memiliki ROLE_USER
dan juga endpoint yang hanya bisa diakses oleh User yang memiliki ROLE_ADMIN
untuk method GET kita ijinkan semua untuk diakses, jadi tanpa login pun bisa
Method : GET
URL : /api/users/me
Response Body :
{
"id" : " number" ,
"username" : " string" ,
"firstName" : " string" ,
"lastName" : " string"
}
Check Username Availability
Method : GET
URL : /api/users/checkUsernameAvailability
Response Body :
{
"available" : " boolean"
}
Method : GET
URL : /api/users/checkEmailAvailability
Response Body :
{
"available" : " boolean"
}
Method : GET
URL : /api/users/{username}/profile
Response Body :
{
"id" : " number" ,
"username" : " string" ,
"firstName" : " string" ,
"lastName" : " string" ,
"joinedAt" : " date" ,
"email" : " string" ,
"address" : [],
"phone" : " string" ,
"postCount" : " number"
}
Method : POST
URL : /api/users/
hanya bisa diakses User ROLE_ADMIN
Request Body :
{
"firstName" : " string" ,
"lastName" : " string" ,
"username" : " string" ,
"password" : " string" ,
"email" : " string" ,
"address" : {
"street" : " string" ,
"suite" : " string" ,
"city" : " string" ,
"zipcode" : " number"
},
"phone" : " number"
}
{
"id" : " number" ,
"firstName" : " string" ,
"lastName" : " string" ,
"username" : " string" ,
"password" : " string" ,
"email" : " string" ,
"address" : {
"street" : " string" ,
"suite" : " string" ,
"city" : " string" ,
"zipcode" : " number"
},
"phone" : " number" ,
"roles" : []
}
bisa diakses oleh user ROLE_USER dan ROLE_ADMIN
Method : PUT
URL : /api/users/{username}
Request Body :
{
"firstName" : " string" ,
"lastName" : " string" ,
"username" : " string" ,
"password" : " string" ,
"email" : " string" ,
"address" : {
"street" : " string" ,
"suite" : " string" ,
"city" : " string" ,
"zipcode" : " number"
},
"phone" : " number"
}
{
"id" : " number" ,
"firstName" : " string" ,
"lastName" : " string" ,
"username" : " string" ,
"password" : " string" ,
"email" : " string" ,
"address" : {
"street" : " string" ,
"suite" : " string" ,
"city" : " string" ,
"zipcode" : " number"
},
"phone" : " number" ,
"roles" : []
}
bisa diakses oleh User ROLE_USER dan ROLE_ADMIN
Method : DELETE
URL : /api/users/{username}
Response Body :
{
"success" : " boolean" ,
"message" : " string" ,
"status" : " string"
}
bisa diakses oleh User ROLE_ADMIN
Method : PUT
URL : /api/users/{username}/giveAdmin
Response Body :
{
"success" : " boolean" ,
"message" : " string" ,
"status" : " string"
}
hanya bisa diakses oleh User ROLE_ADMIN
Method : PUT
URL : /api/users/{username}/removeAdmin
Response Body :
{
"success" : " boolean" ,
"message" : " string" ,
"status" : " string"
}
bisa diakses oleh User ROLE_USER atau ROLE_ADMIN
Method : PUT
URL : /api/users/setOrUpdateInfo
Request Body
{
"street" : " string" ,
"suite" : " string" ,
"city" : " string" ,
"zipcode" : " string" ,
"phone" : " string"
}
{
"id" : " number" ,
"username" : " string" ,
"firstName" : " string" ,
"lastName" : " string" ,
"joinedAt" : " date" ,
"email" : " string" ,
"address" : [],
"phone" : " string" ,
"postCount" : " number"
}