API: Workspace

Methods

List workspace

Returns a collection of workspaces. The collection can be filtered via query parameters similar to how work packages are filtered. In addition to the provided filter, the result set is always limited to only contain workspaces the client is allowed to see.

Since workspaces are the generic term for a number of resources like projects and portfolios, the returned collection will contain a mix of those resources.

filters
string

optional query

JSON specifying filter conditions. Accepts the same format as returned by the queries endpoint. Currently supported filters are:

  • active: based on the active property of the workspace
  • ancestor: filters workspace by their ancestor. A workspace is not considered to be its own ancestor.
  • available_project_attributes: filters workspace based on the activated project attributes.
  • created_at: based on the time the workspace was created
  • favorited: based on the favorited property of the workspace
  • id: based on workspace’ id.
  • latest_activity_at: based on the time the last activity was registered on a workspace.
  • name_and_identifier: based on both the name and the identifier.
  • parent_id: filters workspace by their parent.
  • principal: based on members of the workspace.
  • project_phase_any: based on the project phases active in a workspace.
  • project_status_code: based on status code of the workspace
  • storage_id: filters workspace by linked storages
  • storage_url: filters workspace by linked storages identified by the host url
  • type_id: based on the types active in a workspace.
  • user_action: based on the actions the current user has in the workspace.
  • visible: based on the visibility for the user (id) provided as the filter value. This filter is useful for admins to identify the workspace visible to a user.

There might also be additional filters based on the custom fields that have been configured.

Each defined lifecycle step will also define a filter in this list endpoint. Given that the elements are not static but rather dynamically created on each OpenProject instance, a list cannot be provided. Those filters follow the schema:

  • project_start_gate_[id]: a filter on a project phase’s start gate active in a workspace. The id is the id of the phase the gate belongs to.
  • project_finish_gate_[id]: a filter on a project phase’s finish gate active in a workspace. The id is the id of the phase the gate belongs to.
  • project_phase_[id]: a filter on a project phase active in a workspace. The id is the id of the phase queried for.

Example:
[{ "ancestor": { "operator": "=", "values": ["1"] } }]

sortBy
string

optional query

JSON specifying sort criteria. Currently supported orders are:

  • id
  • name
  • typeahead (sorting by hierarchy and name)
  • created_at
  • public
  • latest_activity_at
  • required_disk_space

There might also be additional orders based on the custom fields that have been configured.

Example:
[["id", "asc"]]

select
string

optional query

Comma separated list of properties to include.

Example:
total,elements/identifier,elements/name

200

OK

{
  "allOf": [
    {
      "$ref": "#/components/schemas/OffsetPaginatedCollectionModel"
    },
    {
      "type": "object",
      "required": [
        "_links",
        "_embedded"
      ],
      "properties": {
        "_links": {
          "allOf": [
            {
              "$ref": "#/components/schemas/OffsetPaginatedCollectionLinks"
            },
            {
              "type": "object",
              "properties": {
                "representations": {
                  "type": "array",
                  "items": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Link"
                      },
                      {
                        "description": "A workspace collection representation in a specific file format."
                      }
                    ]
                  }
                }
              }
            }
          ]
        },
        "_embedded": {
          "type": "object",
          "required": [
            "elements"
          ],
          "properties": {
            "elements": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PortfolioModel"
                  },
                  {
                    "$ref": "#/components/schemas/ProgramModel"
                  },
                  {
                    "$ref": "#/components/schemas/ProjectModel"
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}

400

Returned if the client sends invalid request parameters e.g. filters

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidQuery",
  "message": "Filters Invalid filter does not exist."
}
{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
  "message": "Project can't be blank.",
  "_embedded": {
    "details": {
      "attribute": "project"
    }
  }
}
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "examples": [
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Project can't be blank.",
      "_embedded": {
        "details": {
          "attribute": "project"
        }
      }
    }
  ]
}

Get workspace

Returns a single workspace identified by its id. As workspaces are the generic term for a number of resources like projects and portfolios, the returned entity will be either of those resources.

id
string

required path

The workspace id

Example:
1337

200

OK

404

Returned if the workspace was not found by its id or the user has not the permissions to see it. The permission has any user that is either an instance admin or a member of the workspace.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
  "message": "The requested resource could not be found."
}
{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
  "message": "Project can't be blank.",
  "_embedded": {
    "details": {
      "attribute": "project"
    }
  }
}
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "examples": [
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Project can't be blank.",
      "_embedded": {
        "details": {
          "attribute": "project"
        }
      }
    }
  ]
}

Update workspace

Updates a single workspace identified by its id.

It can be used to archive/reactivate a workspace, sending only the active attribute.

It can be used to edit the workspace information and or the workspace attributes, which both require a different set of permissions.

id
string

required path

The workspace id

Example:
1337

archive workspace

A request body to archive a workspace.

{
  "active": false
}

update workspace information

A request body to update several information of a workspace.

{
  "name": "Death Star 2.0",
  "identifier": "death-star-2",
  "public": false
}
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name of the workspace."
    },
    "identifier": {
      "type": "string",
      "description": "The identifier of the workspace."
    },
    "active": {
      "type": "boolean",
      "description": "Set to `false` to archive a workspace, and to `true to reactive it."
    },
    "public": {
      "type": "boolean",
      "description": "Whether the workspace is public or not."
    },
    "description": {
      "allOf": [
        {
          "$ref": "#/components/schemas/Formattable"
        },
        {
          "description": "The workspace description"
        }
      ]
    }
  }
}

200

OK

404

Returned if the workspace was not found by its id or the user has not the permissions to see it. The permission has any user that is either an instance admin or a member of the workspace.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
  "message": "The requested resource could not be found."
}
{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
  "message": "Project can't be blank.",
  "_embedded": {
    "details": {
      "attribute": "project"
    }
  }
}
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "examples": [
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Project can't be blank.",
      "_embedded": {
        "details": {
          "attribute": "project"
        }
      }
    }
  ]
}

Delete workspace

Deletes a workspace identified by its id.

id
string

required path

The workspace id

Example:
1337

204

Returned if the workspace was successfully deleted.

403

Returned if the user has no permission to delete the workspace. Only instance admins are allowed to delete workspaces.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:Unauthenticated",
  "message": "You are not authorized to access this resource."
}
{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
  "message": "Project can't be blank.",
  "_embedded": {
    "details": {
      "attribute": "project"
    }
  }
}
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "examples": [
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Project can't be blank.",
      "_embedded": {
        "details": {
          "attribute": "project"
        }
      }
    }
  ]
}

404

Returned if the workspace was not found by its id or the user has not the permissions to see it. The permission has any user that is either an instance admin or a member of the workspace.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
  "message": "The requested resource could not be found."
}
{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
  "message": "Project can't be blank.",
  "_embedded": {
    "details": {
      "attribute": "project"
    }
  }
}
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "examples": [
    {
      "_type": "Error",
      "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
      "message": "Project can't be blank.",
      "_embedded": {
        "details": {
          "attribute": "project"
        }
      }
    }
  ]
}