Skip to content

dombiistvan/faceit

Repository files navigation

faceit REST - User CRUD

before start the application, you can change the environmental variables in mysql.conn.env file if you want, but you don't need to change anything by default

MYSQL_ROOT_PASSWORD: gC38a8YrZqq4ZVtD
MYSQL_DATABASE: faceit
MYSQL_USER: faceit
MYSQL_PASSWORD: NootNoot

the application will be reachable in your http://localhost:80 after you started the app by entering docker compose up command

  • you can check the api is running by type in your browser address bar http://localhost/test
    • if everything is fine, you will see an it's alive! message

For each request, the expected response is success and the object/list of objects, or if no content needed, empty response body with appropriate http.StatusCode

Create new User

Method: POST
Content-type: Application/json
URL: http://localhost/user
Request-Body: (example)
{
	"first_name": "Firstname",
	"last_name": "Lastname",
	"nickname": "MyCoolNickName",
	"email": "[email protected]",
	"country": "HU",
	"password": "MySecretPassword_1234"
}

Response if succeeded: (example)
Response Code: 201 - http.StatusCreated

{
	"id": "5c188809-1b2c-41b9-b937-543e9efece79",
	"first_name": "Firstname",
	"last_name": "Lastname",
	"nickname": "MyCoolNickName",
	"email": "[email protected]",
	"country": "HU",
	"CreatedAt": "2023-02-07T16:01:39Z",
	"UpdatedAt": "2023-02-07T16:01:39Z"
}

Update Existing User

Method: PUT
Content-type: Application/json
URL format: http://localhost/user/:UUID
URL: http://localhost/user/5c188809-1b2c-41b9-b937-543e9efece79
Request-Body: (example)
{
	"first_name": "Firstname2",
	"last_name": "Lastname2",
	"email": "[email protected]",
	"country": "UK",
}

Response Code: 200 - http.StatusOK
Response if succeeded: (example)

{
	"id": "5c188809-1b2c-41b9-b937-543e9efece79",
	"first_name": "Firstname2",
	"last_name": "Lastname2",
	"nickname": "MyCoolNickName",
	"email": "[email protected]",
	"country": "UK",
	"CreatedAt": "2023-02-07T17:01:39Z",
	"UpdatedAt": "2023-02-07T17:01:39Z"
}

Delete Existing User

Method: DELETE
URL format: http://localhost/user/:UUID
URL example: http://localhost/user/5c188809-1b2c-41b9-b937-543e9efece79

Response Code: 200 - http.StatusOK
Response Body: no response body

Get Filtered OR unfiltered list of users

Method: GET
URL format: http://localhost/user/list?page=3&limit=10&query_param=value&query_param2=value2....query_paramn=valuen
URL example: http://localhost/user/list?first_name=Dombi&last_name=istvan&nickname=cool&country=hu&email=gmail&id=5c188809-1b2c&page=2&limit=3
Available Filter query params: ```first_name, last_name, nickname, email, country, id```
Available System query params: ```page```(default: 1), ```limit```(default: 10)
Request-Body: no request body

Response Code: 200 - http.StatusOK
Response if succeeded: (example)

[
    {
        "id": "5c188809-1b2c-41b9-b937-543e9efece79",
        "first_name": "Firstname2",
        "last_name": "Lastname2",
        "nickname": "MyCoolNickName",
        "email": "[email protected]",
        "country": "UK",
        "CreatedAt": "2023-02-07T17:01:39Z",
        "UpdatedAt": "2023-02-07T17:01:39Z"
    },
    {
        "id": "68ddbcf8-be80-423e-b3f2-4749f7a4ba16",
        "first_name": "Test",
        "last_name": "Test2",
        "nickname": "Nicktest",
        "email": "[email protected]",
        "country": "US",
        "CreatedAt": "2023-02-07T12:01:39Z",
        "UpdatedAt": "2023-02-07T13:01:39Z"
    },
    {
        "id": "a9a1b605-6a8e-448f-b51d-62c68389101c",
        "first_name": "Kovács",
        "last_name": "András",
        "nickname": "Kovand",
        "email": "[email protected]",
        "country": "CA",
        "CreatedAt": "2023-02-07T14:11:39Z",
        "UpdatedAt": "2023-02-07T15:14:39Z"
    }
]

About

faceit test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages