Skip to content

ejaramillo/messageUserApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Authentication

Login

Login into the API in order to request an access token.

Endpoint

POST /access-token

Request body

{
    username: string,
    password: string
}

Response

{
    access_token: string
}

List of messages by user identification

To use the app, the user must have their authentication permission. Authorization: Bearer {access_token}

Endpoint

GET api/message?recipient_user_id

Where recipient_user_id is required for execution the request. Here recipient_user_id is the user to whom we have interacted.

Response

{
    message: [
        {
            content: string,
            creation_dt: string,
            modification_dt: string,
            deactivated_dt: string,
            message_state_dt: string //YYYY-MM-DD H:i:s,
            user: {
                user_id: int,
                avatar_url: string,
                email: string       
            }  
        },
        ...
    ]
}

List of all user

To use the app, the user must have their authentication permission. Authorization: Bearer {access_token}

Endpoint

GET api/user

Response

{
    user: [
        {
            name: string,
            uuid: string,
            creation_dt: string,
            modification_dt: string,
            deactivated_dt: string,  
            cellphone: string,
            email: string  
        },
        ...
    ]
}

Get user details

To use the app, the user must have their authentication permission. Authorization: Bearer {access_token}

Endpoint

GET api/user/{id_user}

Response

{
    user: [
        {
            name: string,
            uuid: string,
            creation_dt: string,
            modification_dt: string,
            deactivated_dt: string,  
            cellphone: string  
        }
    ]
}

List all message by specific user

To use the app, the user must have their authentication permission. Authorization: Bearer {access_token}

Endpoint

GET api/user/{id_user}/message

Response

{
    message: [
        {
            content: string,
            uuid: string,
            creation_dt: string,
            modification_dt: string,
            deactivated_dt: string,  
            recipient_user_id: int,  
            recipient_state_dt: string,
            user:{
                user_id: int,
                avatar_url: string,
                email: string
            }  
        }
        ...
    ]
}

Create new User

Create request to add new user

Required headers

  • Authorization: Bearer {access_token}

Endpoint

POST /api/user

Request body

{
    name: string,
    cellphone: string,
    email: string 
}

Response HTTP 200

{
    message: {
        name: string,
        uuid: string,
        creation_dt: string,
        modification_dt: string,
        deactivated_dt: string,
        cellphone: string,
        email: string
    }
}

Create new message for specific user

Required headers

  • Authorization: Bearer {access_token}

Endpoint

POST /api/user/{recipient_user_id}/message

Where recipient_user_id is required for execution the request. Here recipient_user_id is the user to whom we have to send a messages.

Request body

{
    content: string
}

Response HTTP 200

{
    message: {
        content: string,
        user_id: int,
        creation_dt: string,
        modification_dt: string,
        deactivated_dt: string
    }
}

Delete a message

Required headers

  • Authorization: Bearer {access_token}

Endpoint

DELETE /api/message/{message_id}

Where message_id is the identifier a message to be deleted, also is required for execution of the request.

**Response HTTP 204 **

{}

Delete a User

Required headers

  • Authorization: Bearer {access_token}

Endpoint

DELETE /api/user/{user_id}

Where user_id is the identifier of an User to be deleted, also is required for execution of the request.

**Response HTTP 204 **

{}

db shema

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published