---
# System prepended metadata

title: Cloudocs REST API reference

---

# Cloudocs REST API reference

## Methods


1. `GET` `/user/events`
    * __Description:__
        Get all user events
    * __Output parameters:__
        ```
        [
            {
                id: integer,
                name: string,
                place: string,
                date: string(DD-MM-YYYY),
                description: string,
                type: {
                    id: int,
                    name: string
                },
                direction: {
                        id: int,
                        name: string
                },
                files: [
                    {
                        url: string,
                        type: string,
                        name: string
                    }
                ],
                tags: [
                    {
                        id: int,
                        name: string
                    }
                ]
            }
        ]
        ```

1. `GET` `/event/last`
    * __Description:__
        Get last event
    * __Output parameters:__
        ```
            {
                id: integer,
                name: string,
                place: string,
                date: string(DD-MM-YYYY),
                description: string,
                type: {
                    id: int,
                    name: string
                },
                direction: {
                        id: int,
                        name: string
                },
                files: [
                    {
                        url: string,
                        type: string,
                        name: string
                    }
                ],
                tags: [
                    {
                        id: int,
                        name: string
                    }
                ]
            }
        ```
    

1. `GET` `/event/types`
    * __Description:__
        Get all events types
    * __Output parameters:__
        ```
        [
            {
                id: int,
                name: string
            }
        ]
        ```

1. `GET` `/event/directions`
    * __Description:__
        Get all events directions
    * __Output parameters:__
        ```
        [
            {
                id: int,
                name: string
            }
        ]
        ```

1. `DELETE` `/event`
    * __Description:__
        Deletes event with id
    * __Input parameters:__
        ```
            {
                "id" : int
            }
        ```
    * __Output parameters:__
        ```
            {
                code: int,
                msg: string
            } 
        ```
    


1. `POST` `/event`
    * __Description:__
        Create new event for user
    * __Input parameters:__
        ```
            {
                name: string,
                date: string(DD-MM-YYYY),
                direction: int,
                type: int,
                files: [ int ],
                tags: [ int ],
                place: string,
                description: string,
            }
        ```
    * __Output parameters:__
        ```
            {
                code: int,
                msg: string
            } 
        ```
    * __Example:__
        ```
        curl -X POST --data '{"name": "some new event", "date": "01-01-2020", "direction": 37, "type": 40, "files": [40], "tags":[108], "place": "ass", "description": "large description"}' http://localhost:8001/event
        ```

___

## Response error
```
    {
        code: int,
        msg: string
    } (with status code 4** or 5**)
```


## Response codes
 - `0` - OK
 - `1` - auth error
 - `2` - malformed data
 - `3` - internal error