Documentation (2024.2 Enterprise)

# Project User

Project user is the link object between Projects and Users. With them, you define who belongs to what project, and what they can do in the project.

- Attributes
- Operations
  - `GET /projects/:project_id/project_users`
  - `GET /projects/:project_id/project_users/:user_id`
  - `POST /projects/:project_id/project_users`
  - `PUT /projects/:project_id/project_users/:user_id`
  - `DELETE /projects/:project_id/project_users/:user_id`

## Attributes

### project

The id of the project the membership is for.

When requesting, can be expanded to the full project object by including the query parameter `expand=project`.

- Type: `string`
- Required: `true`

### user

The id of the user the membership is for.

When requesting, can be expanded to the full user object by including the query parameter `expand=user`.

- Type: `string`
- Required: `true`

### role

The role the user has directly in the project. Must be one of `admin`, `manager`, `master`, `developer`, or `guest`.

- Type: `string`
- Required: `true`

### highest_role

The highest role the user has in the project either directly or through groups. This field is automatically updated.

- Type: `string`

## Operations

### GET /projects/:project_id/project_users

List all project users for a project, with optional limit and offset parameters, as a metadata-results object.

### GET /projects/:project_id/project_users/:user_id

Return a specific project user.

#### Example request

    curl -X GET \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/projects/luotsi/project_users/vluoto

#### Example response

    {
        "api_status": 200,
        "api_timestamp": "2012-10-25T08:42:01Z",
        "project": {
          "id": "luotsi"
        },
        "user": {
          "id": "vluoto"
        },
        "role": "developer",
        "highest_role": "admin"
    }

#### Example request with user and project fields expanded

    curl -X GET \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/projects/luotsi/project_users/vluoto?expand=user,project

#### Example response with user and project fields expanded

    {
        "api_status": 200,
        "api_timestamp": "2012-10-25T09:29:37Z",
        "project": {
            "api_status": 200,
            "api_timestamp": "2012-10-25T09:29:37Z",
            "id": "luotsi",
            "created_at": "2012-10-25T09:29:37Z",
            "updated_at": "2012-10-25T09:29:37Z",
            "name": "Helix TeamHub",
            "description": "Helix TeamHub is Eficode's new product. It's called Helix TeamHub.",
            "color": "green",
            "avatar": {
                "large": "/projects/luotsi/avatars/luotsi_l.png",
                "medium": "/projects/luotsi/avatars/luotsi_m.png",
                "small": "/projects/luotsi/avatars/luotsi_s.png"
            },
            "visibility": "company"
        },
        "user": {
            "api_status": 200,
            "api_timestamp": "2012-10-25T09:29:37Z",
            "id": "vluoto",
            "created_at": "2012-10-25T09:29:37Z",
            "updated_at": "2012-10-25T09:29:37Z",
            "email": "veli-matti.luoto@eficode.com",
            "first_name": "Veli-Matti",
            "last_name": "Luoto",
            "display_name": "Veli-Matti Luoto",
            "company_admin": true,
            "instance_admin": true,
            "description": "*^-D",
            "phone": "+358 50 599 0681",
            "title": "Software Engineer",
            "avatar": {
                "large": "",
                "medium": "",
                "small": "",
            },
            "synchronized_fields": [],
            "locale": "en",
            "source": "",
        },
        "role": "developer",
        "highest_role": "admin"
    }

### POST /projects/:project_id/project_users

Add a project user for a project.

#### Example request

    curl -X POST \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      -H "Content-Type: application/json" \
      -d '{ "id": "asyrjasalo", "role": "guest" }' \
      https://helixteamhub.cloud/api/projects/luotsi/project_users

#### Example response

    {
      "api_status": 201,
      "api_timestamp": "2012-10-25T09:29:37Z",
      "project": {
        "id": "luotsi"
      },
      "user": {
        "id": "asyrjasalo"
      },
      "role": "guest",
      "highest_role": "guest"
    }

### PUT /projects/:project_id/project_users/:user_id

Update role for a project user. Returns the updated project user.

#### Example request

    curl -X PUT \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      -H "Content-Type: application/json" \
      -d '{ "role": "admin" }' \
      https://helixteamhub.cloud/api/projects/luotsi/project_users/asyrjasalo

#### Example response

    {
      "api_status": 200,
      "api_timestamp": "2013-11-28T10:12:20Z",
      "project": {
        "id": "luotsi"
      },
      "user": {
        "id": "asyrjasalo"
      },
      "role": "admin",
      "highest_role": "admin"
    }

### DELETE /projects/:project_id/project_users/:user_id

Remove a user from a project. Returns the removed project user.

#### Example request

    curl -X DELETE \
      -H "Accept: application/vnd.hth.v1" \
      -H "Authorization: hth.company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
      https://helixteamhub.cloud/api/projects/luotsi/project_users/asyrjasalo

#### Example response

    {
      "api_status": 200,
      "api_timestamp": "2013-11-28T10:12:28Z",
      "project": {
        "id": "luotsi"
      },
      "user": {
        "id": "asyrjasalo"
      },
      "role": "admin",
      "highest_role": "admin"
    }

Your search for returned results

Your search for returned results