Skip to content

v-dev-cl/spring-user-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-user-demo

Spring Boot Rest Demo with h2 db, gradle, java 11.

Some unit tests with jUnit 5 and MockMVC.


Post User Example

curl --location --request POST 'localhost:8080/users/' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Juan Rodriguez",
"email": "[email protected]",
"password": "hunterR2",
"phones": [
{
"number": "1234567",
"citycode": "1",
"contrycode": "57"
}
],
"active": true
}'

Post User Response

{
    "id": "43b74e9b-0e15-4f46-ae6c-666f62c34137",
    "name": "Juan Rodriguez",
    "email": "[email protected]",
    "password": "hunterR2",
    "created": "2021-07-22T14:52:05.446854067",
    "updated": "2021-07-22T14:52:05.446899047",
    "lastLogin": "2021-07-22T14:52:05.414104555",
    "token": "2ac5cdae-dadd-4216-b609-4f2a4492fd21",
    "isActive": true,
    "phones": [
        {
            "number": "1234567",
            "citycode": "1",
            "contrycode": "57"
        }
    ]
}

Partial Update User

curl --location --request PATCH 'localhost:8080/users/43b74e9b-0e15-4f46-ae6c-666f62c34137' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Juan Rodriguez2",
    "email": "[email protected]",
    "isActive": false
}'

Partial Update Response

{
    "id": "43b74e9b-0e15-4f46-ae6c-666f62c34137",
    "name": "Juan Rodriguez2",
    "email": "[email protected]",
    "password": "hunterR2",
    "created": "2021-07-22T14:52:05.446854",
    "updated": "2021-07-22T14:54:20.290479275",
    "lastLogin": "2021-07-22T14:52:05.414105",
    "token": "2ac5cdae-dadd-4216-b609-4f2a4492fd21",
    "isActive": false,
    "phones": [
        {
            "number": "1234567",
            "citycode": "1",
            "contrycode": "57"
        }
    ]
}

Delete Existing User

curl --location --request DELETE 'localhost:8080/users/43b74e9b-0e15-4f46-ae6c-666f62c34137'

Delete Existing User Response Status 200

{
    "id": "43b74e9b-0e15-4f46-ae6c-666f62c34137",
    "name": "Juan Rodriguez2",
    "email": "[email protected]",
    "password": "hunterR2",
    "created": "2021-07-22T14:52:05.446854",
    "updated": "2021-07-22T14:54:20.290479",
    "lastLogin": "2021-07-22T14:52:05.414105",
    "token": "2ac5cdae-dadd-4216-b609-4f2a4492fd21",
    "isActive": false,
    "phones": [
        {
            "number": "1234567",
            "citycode": "1",
            "contrycode": "57"
        }
    ]
}

Delete Non Existing User Error Response Status 404

{
    "mensaje": "No encontrado"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages