Unicat API Reference

Up - API Reference - Home


/api/init

Requires JWT

Get initial user and projects data.

Request

GET /api/init
Authorization: Bearer <JWT>

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "user": "<user gid>",
        "user_projects": {
            "<project gid>": [
                "owner"
            ],
            
        },
        "cc.version": "2022.01.001",
        "cc.cursor": 4132
    },
    "data": {
        "cc.users": {
            "<user gid>": {
                "gid": "<user gid>",
                "username": "user-name",
                "email": "<user email>",
                "name": "User Name",
                "avatar": "1ad71cbd-9b97-4ea7-94ef-bcdd86c6467c.jpg",
                "status": "active",
                "options": {
                    "language": "en",
                    "timezone": "Europe/Amsterdam"
                }
            }
        },
        "cc.projects": {
            "<project gid>": {
                "gid": "<project gid>",
                "name": "Project Name",
                "icon": "<project gid>.jpg",
                "owner": "<user gid>",
                "status": "active"
            },
            
        },
        "cc.projects_members": [
            {
                "project_gid": "<project gid>",
                "user_gid": "<user gid>",
                "status": "active",
                "roles": [
                    "owner"
                ],
                "options": {
                    "notifications": {
                        "email": "<user email>",
                        "events": [
                            "all"
                        ],
                        "frequency": "immediate"
                    },
                    "rate_limit_per_second": null
                }
            },
            
        ],
        "cc.languages": {
            "da": "Danish",
            "nl": "Dutch",
            
        },
    }
}

A fresh JWT is in the Authorization header.

result

user is the user gid for the current user.
user_projects is a dictionary of zero or more projects that are owned by this user or the user is a member of.
cc.version is the current version.
cc.cursor a sync cursor, to keep cc-data in sync.

data

cc.users is a dictionary with entries for the current user and members of a user's projects.
cc.projects is a dictionary with metadata for each project.
cc.projects_members is a list with metadata for project-owner membership.
cc.languages available languages for internationalization and localization.

Error response

401 Unauthorized - missing or expired JWT

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="JWT access to Unicat."

{
    "success": false,
    "result": {
        "code": 401,
        "message": "Permission denied",
        "info": {}
    },
    "data": {}
}