# openapi.api.NewsApi ## Load the API package ```dart import 'package:openapi/api.dart'; ``` All URIs are relative to *https://community.openproject.org* Method | HTTP request | Description ------------- | ------------- | ------------- [**listNews**](NewsApi.md#listnews) | **GET** /api/v3/news | List News [**viewNews**](NewsApi.md#viewnews) | **GET** /api/v3/news/{id} | View news # **listNews** > Object listNews(offset, pageSize, sortBy, filters) List News Lists news. The news returned depend on the provided parameters and also on the requesting user's permissions. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = NewsApi(); final offset = 25; // int | Page number inside the requested collection. final pageSize = 25; // int | Number of elements to display per page. final sortBy = [["created_at", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are: + id: Sort by primary key + created_at: Sort by news creation datetime final filters = [{ "project_id": { "operator": "=", "values": ["1", "2"] } }]; // String | JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + project_id: Filter news by project try { final result = api_instance.listNews(offset, pageSize, sortBy, filters); print(result); } catch (e) { print('Exception when calling NewsApi->listNews: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **offset** | **int**| Page number inside the requested collection. | [optional] [default to 1] **pageSize** | **int**| Number of elements to display per page. | [optional] **sortBy** | **String**| JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are: + id: Sort by primary key + created_at: Sort by news creation datetime | [optional] **filters** | **String**| JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + project_id: Filter news by project | [optional] ### Return type [**Object**](Object.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **viewNews** > NewsModel viewNews(id) View news ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = NewsApi(); final id = 1; // int | news id try { final result = api_instance.viewNews(id); print(result); } catch (e) { print('Exception when calling NewsApi->viewNews: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| news id | ### Return type [**NewsModel**](NewsModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)