API: News

News are articles written by users in order to inform other users of important information.

Actions

None yet

Linked Properties

Link Description Type Constraints Supported operations Condition
self This news News not null READ
project The project the news is situated in Project not null READ / WRITE
author The user having created the news User not null READ

Local Properties

Property Description Type Constraints Supported operations Condition
id News’ id Integer x > 0 READ
title The headline of the news String max 60 characters READ
summary A short summary String max 255 characters READ  
description The main body of the news with all the details String READ
createdAt The time the news was created at DateTime READ  

Methods

List news

Lists news. The news returned depend on the provided parameters and also on the requesting user’s permissions.

offset
integer

optional query

Page number inside the requested collection.

Default:
1

Example:
25

pageSize
integer

optional query

Number of elements to display per page.

Example:
25

sortBy
string

optional query

JSON specifying sort criteria. Accepts the same format as returned by the queries endpoint. Currently supported sorts are:

  • id: Sort by primary key

  • created_at: Sort by news creation datetime

Example:
[["created_at", "asc"]]

filters
string

optional query

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

  • project_id: Filter news by project

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

200

OK

{
  "_embedded": {
    "elements": [
      {
        "_links": {
          "author": {
            "href": "/api/v3/users/2",
            "title": "Peggie Feeney"
          },
          "project": {
            "href": "/api/v3/projects/1",
            "title": "Seeded Project"
          },
          "self": {
            "href": "/api/v3/news/1",
            "title": "asperiores possimus nam doloribus ab"
          }
        },
        "_type": "News",
        "createdAt": "2015-03-20T12:57:01.209Z",
        "description": {
          "format": "markdown",
          "html": "<p>Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.</p>",
          "raw": "Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui."
        },
        "id": 1,
        "summary": "Celebrer spiculum colo viscus claustrum atque. Id nulla culpa sumptus. Comparo crapula depopulo demonstro.",
        "title": "asperiores possimus nam doloribus ab"
      },
      {
        "_links": {
          "author": {
            "href": "/api/v3/users/2",
            "title": "Peggie Feeney"
          },
          "project": {
            "href": "/api/v3/projects/1",
            "title": "Seeded Project"
          },
          "self": {
            "href": "/api/v3/news/2",
            "title": "terminatio tutamen. Officia adeptio sp"
          }
        },
        "_type": "News",
        "createdAt": "2015-03-20T12:57:01.262Z",
        "description": {
          "format": "markdown",
          "html": "<p>Amicitia alius cattus voluntarius. Virgo viduo terminatio tutamen. Officia adeptio spectaculum atavus nisi cum concido bis. Harum caecus auxilium sol theatrum eaque consequatur. Omnis aeger suus adipisci cicuta. Cur delicate alias curto cursim atqui talio fugiat.</p>",
          "raw": "Amicitia alius cattus voluntarius. Virgo viduo terminatio tutamen. Officia adeptio spectaculum atavus nisi cum concido bis. Harum caecus auxilium sol theatrum eaque consequatur. Omnis aeger suus adipisci cicuta. Cur delicate alias curto cursim atqui talio fugiat."
        },
        "id": 2,
        "summary": "Consequatur sequi surculus creo tui aequitas.",
        "title": "terminatio tutamen. Officia adeptio sp"
      }
    ]
  },
  "_links": {
    "changeSize": {
      "href": "/api/v3/news?offset=1&pageSize=%7Bsize%7D",
      "templated": true
    },
    "jumpTo": {
      "href": "/api/v3/news?offset=%7Boffset%7D&pageSize=2",
      "templated": true
    },
    "nextByOffset": {
      "href": "/api/v3/news?offset=2&pageSize=2"
    },
    "self": {
      "href": "/api/v3/news?offset=1&pageSize=2"
    }
  },
  "_type": "Collection",
  "count": 2,
  "offset": 1,
  "pageSize": 2,
  "total": 78
}
List_of_NewsModel
{
  "type": "object",
  "example": {
    "_type": "Collection",
    "total": 78,
    "count": 2,
    "pageSize": 2,
    "offset": 1,
    "_embedded": {
      "elements": [
        {
          "_type": "News",
          "id": 1,
          "title": "asperiores possimus nam doloribus ab",
          "summary": "Celebrer spiculum colo viscus claustrum atque. Id nulla culpa sumptus. Comparo crapula depopulo demonstro.",
          "description": {
            "format": "markdown",
            "raw": "Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.",
            "html": "<p>Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.</p>"
          },
          "createdAt": "2015-03-20T12:57:01.509Z",
          "_links": {
            "self": {
              "href": "/api/v3/news/1",
              "title": "asperiores possimus nam doloribus ab"
            },
            "project": {
              "href": "/api/v3/projects/1",
              "title": "Seeded Project"
            },
            "author": {
              "href": "/api/v3/users/2",
              "title": "Peggie Feeney"
            }
          }
        },
        {
          "_type": "News",
          "id": 2,
          "title": "terminatio tutamen. Officia adeptio sp",
          "summary": "Consequatur sequi surculus creo tui aequitas.",
          "description": {
            "format": "markdown",
            "raw": "Amicitia alius cattus voluntarius. Virgo viduo terminatio tutamen. Officia adeptio spectaculum atavus nisi cum concido bis. Harum caecus auxilium sol theatrum eaque consequatur. Omnis aeger suus adipisci cicuta. Cur delicate alias curto cursim atqui talio fugiat.",
            "html": "<p>Amicitia alius cattus voluntarius. Virgo viduo terminatio tutamen. Officia adeptio spectaculum atavus nisi cum concido bis. Harum caecus auxilium sol theatrum eaque consequatur. Omnis aeger suus adipisci cicuta. Cur delicate alias curto cursim atqui talio fugiat.</p>"
          },
          "createdAt": "2015-03-20T12:57:01.509Z",
          "_links": {
            "self": {
              "href": "/api/v3/news/2",
              "title": "terminatio tutamen. Officia adeptio sp"
            },
            "project": {
              "href": "/api/v3/projects/1",
              "title": "Seeded Project"
            },
            "author": {
              "href": "/api/v3/users/2",
              "title": "Peggie Feeney"
            }
          }
        }
      ]
    },
    "_links": {
      "self": {
        "href": "/api/v3/news?offset=1&pageSize=2"
      },
      "jumpTo": {
        "href": "/api/v3/news?offset=%7Boffset%7D&pageSize=2",
        "templated": true
      },
      "changeSize": {
        "href": "/api/v3/news?offset=1&pageSize=%7Bsize%7D",
        "templated": true
      },
      "nextByOffset": {
        "href": "/api/v3/news?offset=2&pageSize=2"
      }
    }
  }
}

400

Occurs when the client did not send a valid JSON object in the request body.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
  "message": "The request body was not a single JSON object."
}
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."
    }
  }
}

403

Returned if the client is not logged in and login is required.

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",
  "message": "You are not authorized to view 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."
    }
  }
}

View news

id
integer

required path

news id

Example:
1

200

OK

{
  "_embedded": {
    "author": {
      "_type": "User..."
    },
    "project": {
      "_type": "Project..."
    }
  },
  "_links": {
    "author": {
      "href": "/api/v3/users/2",
      "title": "Peggie Feeney"
    },
    "project": {
      "href": "/api/v3/projects/1",
      "title": "A project"
    },
    "self": {
      "href": "/api/v3/news/1",
      "title": "asperiores possimus nam doloribus ab"
    }
  },
  "_type": "News",
  "createdAt": "2015-03-20T12:57:01.601Z",
  "description": {
    "format": "markdown",
    "html": "<p>Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.</p>",
    "raw": "Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui."
  },
  "id": 1,
  "summary": "Celebrer spiculum colo viscus claustrum atque. Id nulla culpa sumptus. Comparo crapula depopulo demonstro.",
  "title": "asperiores possimus nam doloribus ab"
}
NewsModel
{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "News' id",
      "readOnly": true,
      "exclusiveMinimum": 0
    },
    "title": {
      "type": "string",
      "description": "The headline of the news",
      "readOnly": true
    },
    "summary": {
      "type": "string",
      "description": "A short summary",
      "readOnly": true
    },
    "description": {
      "type": "string",
      "description": "The main body of the news with all the details",
      "readOnly": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "The time the news was created at",
      "readOnly": true
    },
    "_links": {
      "type": "object",
      "required": [
        "self",
        "project",
        "author"
      ],
      "properties": {
        "self": {
          "allOf": [
            {
              "$ref": "#/components/schemas/Link"
            },
            {
              "description": "This news\n\n**Resource**: News",
              "readOnly": true
            }
          ]
        },
        "project": {
          "allOf": [
            {
              "$ref": "#/components/schemas/Link"
            },
            {
              "description": "The project the news is situated in\n\n**Resource**: Project"
            }
          ]
        },
        "author": {
          "allOf": [
            {
              "$ref": "#/components/schemas/Link"
            },
            {
              "description": "The user having created the news\n\n**Resource**: User",
              "readOnly": true
            }
          ]
        }
      }
    }
  },
  "example": {
    "_type": "News",
    "id": 1,
    "title": "asperiores possimus nam doloribus ab",
    "summary": "Celebrer spiculum colo viscus claustrum atque. Id nulla culpa sumptus. Comparo crapula depopulo demonstro.",
    "description": {
      "format": "markdown",
      "raw": "Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.",
      "html": "<p>Videlicet deserunt aequitas cognatus. Concedo quia est quia pariatur vorago vallum. Calco autem atavus accusamus conscendo cornu ulterius. Tam patria ago consectetur ventito sustineo nihil caecus. Supra officiis eos velociter somniculosus tonsor qui. Suffragium aduro arguo angustus cogito quia tolero vulnus. Supplanto sortitus cresco apud vestrum qui.</p>"
    },
    "createdAt": "2015-03-20T12:57:01.908Z",
    "_links": {
      "self": {
        "href": "/api/v3/news/1",
        "title": "asperiores possimus nam doloribus ab"
      },
      "project": {
        "href": "/api/v3/projects/1",
        "title": "A project"
      },
      "author": {
        "href": "/api/v3/users/2",
        "title": "Peggie Feeney"
      }
    },
    "_embedded": {
      "project": {
        "_type": "Project..."
      },
      "author": {
        "_type": "User..."
      }
    }
  }
}

404

Returned if the news does not exist or if the user does not have permission to view it.

Required permission being member of the project the news belongs to

{
  "_type": "Error",
  "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
  "message": "The requested resource could not be found."
}
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."
    }
  }
}