Skip to content

API Overview

This section will go over main components of the API and how to use them.

flowchart LR
    Accs(Accounts) -----------> A1(John)

    Ws(Workspaces) --> W1(Workspace)

    W1 --> W1Polls(Polls)
    W1 --> W1Gs(Groups) 
    W1 --> W1Ps(Policies)
    W1 --> W1Ms(Workspace \n Members)


    W1Gs -----> G1(Group A)
    G1 --> G1Ps(Policies)
    G1Ps ---> G1P1(John Group Policy)
    G1 --> G1Ms(Group Members)
    G1Ms ----> W1M1(Member John)
    G1P1 --> W1M1

    W1Ps --> W1P2(Group A Policy)
    W1P2 ----> G1
    W1M1 --> A1

    W1Ps --> W1P1(John Workspace Policy)

    W1Ms ---------> W1M1(Member John)
    W1P1 --------> W1M1

    W1Polls --> W1Poll1(Poll)
    W1Poll1 --> Poll1Ps(Policies)
    Poll1Ps --> Poll1P1(Group A Policy)
    Poll1P1 --> G1

Accounts

Accounts represent users of the API. They are used to authenticate and authorize users. When user registers, an account is created for them.

Class Definition:

  • id - unique identifier of the account
  • email - email address of the account
  • password - password of the account (stored hashed)
  • First Name - first name of the account
  • Last Name - last name of the account

Workspaces

The API is organized around workspaces. Each workspace has its own set of groups, policies, members and polls. You can think of workspace as a separate organization, or a class, or simply an isolated environment. Every user can create a workspace and invite other users to it.

flowchart LR
    Accs(Accounts) --------> A1(John)

    Ws(Workspaces) --> W1(Workspace)

    W1 ----> W1Polls(Polls)
    W1 --> W1Gs(Groups) 
    W1 ----> W1Ps(Policies)
    W1 --> W1Ms(Members)


    W1Gs -----> G1(Group)

    W1Ps --> W1P2(Group Policy)
    W1P2 ----> G1

    W1Ps --> W1P1(John Policy)
    W1P1 -.-> W1M1

    W1Ms ---> W1M1(Member John)
    W1M1 --> A1

    W1Polls --> W1Poll1(Poll)
    W1Poll1 --> Poll1Ps(Policies)
    Poll1Ps --> Poll1P1(Group Policy)
    Poll1P1 -.-> G1

Class Definition:

  • id - Unique identifier of the workspace document
  • name - Name of the workspace, must be unique
  • description - Description of the workspace
  • members - List of members of the workspace
  • groups - List of groups in the workspace
  • policies - List of policies in the workspace
  • polls - List of polls in the workspace

Members

When a user is invited to a workspace, they become a member of that workspace. Members can be assigned to groups. Each member has a unique policy in the workspace which defines their permissions in the workspace.

Similarly, groups also have members and policies. To become a member of a group, a user must first be a member of the workspace. Each member of the group has a unique Group policy which defines their permissions in the group.

Member class is used to link accounts to resources.

Class Definition:

  • id - Unique identifier of the member document
  • account - Account of the member
  • workspace - Workspace the member belongs to
  • groups - List of groups the member belongs to
  • policies - List of policies of the member in the workspace/groups/polls

Groups

Groups allow you to organize members of the workspace. Each group has its own policy in the workspace which defines permissions of all members of that group.

flowchart LR
    Accs(Accounts) -------> A1(John)

    G1(Group)
    G1 ----> G1Ps(Policies)
    G1 --> G1Ms(Members)
    G1Ms ---> W1M1(Member John)
    G1Ps --> G1P1(John Policy)
    G1P1 --> W1M1

    W1Ms(Workspace Memmber)
    W1Ms ------> W1M1(Member John)
    W1M1 --> A1

Class Definition:

  • id - Unique identifier of the group
  • name - Name of the group, must be unique
  • description - Description of the group
  • members - List of members of the group
  • policies - List of policies in the group
  • workspace - Workspace the group belongs to

Policies

Policies define permissions of members and groups. Each member or group has a unique policy in the workspace. Inside group, each member has a unique Group policy.

Class Definition:

  • id - Unique identifier of the policy
  • parent_resource - Resource the policy belongs to (workspace, group, poll)
  • policy_holder_type - Type of the policy holder (Internal usage)
  • policy_holder - Policy holder (Account/Group)
  • permissions - Integer representation of permissions

Polls

Polls are used to collect votes from members of the workspace. Each poll has its own set of questions and policies. Policies define permissions of members and groups in the workspace, which actions they can perform in the poll. The polls can be public or private. Public polls can be accessed by anyone, while private polls can only be accessed by members with appropriate permissions.