# REST API Python
## Instruction
1. Change config.py
2. Open **cmd** and go to ```cd C:/your_path/RestApiPython/rest_api_venv/Scripts```
3. Entered the following commands ```activate.bat```, ```cd ../../``` and ```python api.py```

## Requests
### GET ```http://127.0.0.2:8080/user/10``` - get one user by id
```json
{
    "birthday": "Tue, 07 Jun 2022 00:00:00 GMT",
    "id": 10,
    "idrole": 2,
    "insys": true,
    "lastlogintime": "Tue, 07 Jun 2022 19:25:00 GMT",
    "name": "Evgen4"
}
```
### GET ```http://127.0.0.2:8080/users``` - get all users
```json
[
    {
        "birthday": "Sat, 04 Mar 2000 00:00:00 GMT",
        "id": 4,
        "insys": true,
        "lastlogintime": "Mon, 16 May 2011 15:36:38 GMT",
        "name": "Evgen Polivanov",
        "role_name": "Admin"
    },
    {
        "birthday": "Tue, 07 Jun 2022 00:00:00 GMT",
        "id": 6,
        "insys": true,
        "lastlogintime": "Tue, 07 Jun 2022 16:58:29 GMT",
        "name": "Evgen Polivanov",
        "role_name": "User"
    }
]
```
### POST ```http://127.0.0.2:8080/adduser``` - add user and return id added user
**BODY**
```json
{
    "name" : "Evgen",
    "reg_date" : "07-06-2022",
    "log_time" : "07-06-2022 19:25",
    "in_sys" : true,
    "role_id" : 2
}
```
### POST ```http://127.0.0.2:8080/updateuser``` - update name user by id
**BODY**
```json
{
    "id" : 10,
    "name" : "Other name"
}
```
### POST ```http://127.0.0.2:8080/deleteuser``` - delete user by id
**BODY**
```json
{
    "id" : 10
}
```
