# Group Users API

The users API will allow you to work with the users, roles and permissions.

## Users resource [/api/users]
It requires your user to have permissions to fetch, create, update or delete users in the system depending on the request you want to make

### List users [GET]

This endpoint will allow you to get the users registered in the system

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

+ Response 200 (application/json)

    + Attributes
        + data (array)
            + (User Object)
            + (User Object)
            + (User Object)
            + (User Object)
        + meta
            + pagination (User Pagination)

+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)

### Create User [POST]
This endpoint will allow you to create a user in the system

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

    + Attributes (User Create)

+ Response 201 (application/json)

    + Attributes
        + data (User Object)

+ Response 422 (application/json)

    + Attributes (Error 422)

+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)

### Get single user [GET /api/users/{id}]

This endpoint will allow you to get a single user

+ Parameters
    + id: `d4d42ea0-ee77-11e6-b823-6d63c6504afc` (string, required) The user ID

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

+ Response 200 (application/json)

    + Attributes
        + data (User Object)


+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)

### Update User [PUT /api/users/{id}]

This endpoint will allow you to update the user's information, in this case the payload will have to contain all the entity to be updated.
+ Parameters
    + id: `d4d42ea0-ee77-11e6-b823-6d63c6504afc` (string, required) The user ID

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

    + Attributes (User Update Full)

+ Response 200 (application/json)

    + Attributes
        + data (User Object)

+ Response 422 (application/json)

    + Attributes (Error 422)

+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)

### Partial update User [PATCH /api/users/{id}]
This endpoint will allow you to update the user's information, please note that the attributes are optional meaning you can send only one per request and only that field will be updated.

+ Parameters
    + id: `d4d42ea0-ee77-11e6-b823-6d63c6504afc` (string, required) The user ID

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

    + Attributes (User Update)

+ Response 200 (application/json)

    + Attributes
        + data (User Object)

+ Response 422 (application/json)

    + Attributes (Error 422)

+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)


### Delete User [DELETE /api/users/{id}]
This endpoint will allow you to delete a user from the system

+ Parameters
    + id: `d4d42ea0-ee77-11e6-b823-6d63c6504afc` (string, required) The user ID

+ Request (application/json)

    + Headers

            Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBlOGVhOGY0YWY2Yjg3NzU0YjZjZDBjNjdkNzBmMjdhYTZkMmRjNjU3YzIwYTU0MjQ3NWRlZGU4Y2VkNTc1N2IwZDcwMWFmNTAyMGU4MGE4In0.eyJhdWQiOiIxIiwianRpIjoiMGU4ZWE4ZjRhZjZiODc3NTRiNmNkMGM2N2Q3MGYyN2FhNmQyZGM2NTdjMjBhNTQyNDc1ZGVkZThjZWQ1NzU3YjBkNzAxYWY1MDIwZTgwYTgiLCJpYXQiOjE0NzYyOTk1NTQsIm5iZiI6MTQ3NjI5OTU1NCwiZXhwIjoxNDc3NTk1NTU0LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0. 

+ Response 204 (application/json)

+ Response 422 (application/json)

    + Attributes (Error 422)

+ Response 401 (application/json)

    + Attributes (Error 401)

+ Response 403 (application/json)

    + Attributes (Error 403)

+ Response 404 (application/json)

    + Attributes (Error 404)

<!-- include(roles.apib) -->
<!-- include(permissions.apib) -->
<!-- include(profile.apib) -->
