API: Query Sort Bys

A QuerySortBy can be referenced by a Query to denote the sorting applied to the query’s work package results. It consists of the columns to sort by as well as the direction (ascending/descending)

Actions

As of now, no actions are defined.

Linked Properties

Property Description Type Constraints Supported operations
self This query sort by QuerySortBy not null READ
column The QueryColumn to sort on. QueryColumn not null READ
direction The direction the QueryColumn is to be sorted in. This property is identified by a URI (urn:openproject-org:api:v3:queries:directions:asc or urn:openproject-org:api:v3:queries:directions:desc) instead of by a URL. not null READ

Local Properties

Property Description Type Constraints Supported operations
id QuerySortBy id String not null READ
name QuerySortBy name String not null READ

Methods

View query sort by

Retrieve an individual QuerySortBy as identified by the id parameter.

id
string

required path

QuerySortBy identifier. The identifier is a combination of the column identifier and the direction.

Example:
status-asc

200

OK

{
  "_links": {
    "column": {
      "href": "/api/v3/queries/columns/status",
      "title": "Status"
    },
    "direction": {
      "href": "urn:openproject-org:api:v3:queries:directions:asc",
      "title": "Ascending"
    },
    "self": {
      "href": "/api/v3/queries/sort_bys/status-asc",
      "title": "Status (Ascending)"
    }
  },
  "_type": "QuerySortBy",
  "id": "status-asc",
  "name": "Status (Ascending)"
}
Query_Sort_ByModel
{
  "type": "object",
  "required": [
    "id",
    "name"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "QuerySortBy id",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "QuerySortBy name"
    }
  },
  "example": {
    "_type": "QuerySortBy",
    "id": "status-asc",
    "name": "Status (Ascending)",
    "_links": {
      "self": {
        "href": "/api/v3/queries/sort_bys/status-asc",
        "title": "Status (Ascending)"
      },
      "column": {
        "href": "/api/v3/queries/columns/status",
        "title": "Status"
      },
      "direction": {
        "href": "urn:openproject-org:api:v3:queries:directions:asc",
        "title": "Ascending"
      }
    }
  }
}

403

Returned if the client does not have sufficient permissions to see it.

Required permission: view work package in any project

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

404

Returned if the QuerySortBy does not exist.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
  "message": "The specified query does not exist."
}
ErrorResponse
{
  "type": "object",
  "required": [
    "_type",
    "errorIdentifier",
    "message"
  ],
  "properties": {
    "_embedded": {
      "type": "object",
      "properties": {
        "details": {
          "type": "object",
          "properties": {
            "attribute": {
              "type": "string",
              "example": "project"
            }
          }
        }
      }
    },
    "_type": {
      "type": "string",
      "enum": [
        "Error"
      ]
    },
    "errorIdentifier": {
      "type": "string",
      "example": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation"
    },
    "message": {
      "type": "string",
      "example": "Project can't be blank."
    }
  }
}