# REST API Python
## Instruction
1. Change config.py
2. Open **cmd** and go to ```cd C:/your_path/pythoRestApi/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",
    "email" : "test@test.com",
    "password" : "1234"
}
```
### 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",
        "email" : "test@test.com",
        "password" : "1234"
    },
    {
        "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",
        "email" : "test@test.com",
        "password" : "1234"
    }
]
```
### 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,
    "email" : "test@test.com",
    "password" : "1234"
}
```
### POST ```http://127.0.0.2:8080/auth``` - login in system. Return access_token.
**BODY**
```json
{
    "login_email" : "Evgen",
    "password" : "1234"
}
```
### POST ```http://127.0.0.2:8080/updateuser``` - update name user by access_token
**BODY**
```json
{
    "name" : "Other name"
}
```
### POST ```http://127.0.0.2:8080/deleteuser``` - delete user by id
**BODY**
```json
{
    "id" : 10
}
```
