# openapi.api.RelationsApi ## Load the API package ```dart import 'package:openapi/api.dart'; ``` All URIs are relative to *https://community.openproject.org* Method | HTTP request | Description ------------- | ------------- | ------------- [**deleteRelation**](RelationsApi.md#deleterelation) | **DELETE** /api/v3/relations/{id} | Delete Relation [**editRelation**](RelationsApi.md#editrelation) | **PATCH** /api/v3/relations/{id} | Edit Relation [**listRelations**](RelationsApi.md#listrelations) | **GET** /api/v3/relations | List Relations [**relationEditForm**](RelationsApi.md#relationeditform) | **POST** /api/v3/relations/{id}/form | Relation edit form [**viewRelation**](RelationsApi.md#viewrelation) | **GET** /api/v3/relations/{id} | View Relation [**viewRelationSchema**](RelationsApi.md#viewrelationschema) | **GET** /api/v3/relations/schema | View relation schema [**viewRelationSchemaForType**](RelationsApi.md#viewrelationschemafortype) | **GET** /api/v3/relations/schema/{type} | View relation schema for type # **deleteRelation** > deleteRelation(id) Delete Relation Deletes the relation. ### 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 = RelationsApi(); final id = 1; // int | Relation ID try { api_instance.deleteRelation(id); } catch (e) { print('Exception when calling RelationsApi->deleteRelation: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| Relation ID | ### Return type void (empty response body) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json, text/plain [[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) # **editRelation** > RelationModel editRelation(id) Edit Relation When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body. It is only allowed to provide properties or links supporting the **write** operation. Note that changing the `type` of a relation invariably also changes the respective `reverseType` as well as the \"name\" of it. The returned Relation object will reflect that change. For instance if you change a Relation's `type` to \"follows\" then the `reverseType` will be changed to `precedes`. ### 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 = RelationsApi(); final id = 1; // int | Relation ID try { final result = api_instance.editRelation(id); print(result); } catch (e) { print('Exception when calling RelationsApi->editRelation: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| Relation ID | ### Return type [**RelationModel**](RelationModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json, text/plain [[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) # **listRelations** > Object listRelations(filters, sortBy) List Relations Lists all relations according to the given (optional, logically conjunctive) filters and ordered by ID. The response only includes relations between work packages which the user is allowed to see. ### 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 = RelationsApi(); final filters = [{ "from": { "operator": "=", "values": 42 }" }]; // String | JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Valid fields to filter by are: + id - ID of relation + from - ID of work package from which the filtered relations emanates. + to - ID of work package to which this related points. + involved - ID of either the `from` or the `to` work package. + type - The type of relation to filter by, e.g. \"follows\". final sortBy = [["type", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. try { final result = api_instance.listRelations(filters, sortBy); print(result); } catch (e) { print('Exception when calling RelationsApi->listRelations: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **filters** | **String**| JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Valid fields to filter by are: + id - ID of relation + from - ID of work package from which the filtered relations emanates. + to - ID of work package to which this related points. + involved - ID of either the `from` or the `to` work package. + type - The type of relation to filter by, e.g. \"follows\". | [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. | [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) # **relationEditForm** > Object relationEditForm(id) Relation edit form ### 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 = RelationsApi(); final id = 1; // int | ID of the relation being modified try { final result = api_instance.relationEditForm(id); print(result); } catch (e) { print('Exception when calling RelationsApi->relationEditForm: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| ID of the relation being modified | ### 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) # **viewRelation** > RelationModel viewRelation(id) View Relation ### 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 = RelationsApi(); final id = 1; // int | Relation id try { final result = api_instance.viewRelation(id); print(result); } catch (e) { print('Exception when calling RelationsApi->viewRelation: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| Relation id | ### Return type [**RelationModel**](RelationModel.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) # **viewRelationSchema** > Object viewRelationSchema() View relation schema ### 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 = RelationsApi(); try { final result = api_instance.viewRelationSchema(); print(result); } catch (e) { print('Exception when calling RelationsApi->viewRelationSchema: $e\n'); } ``` ### Parameters This endpoint does not need any parameter. ### 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) # **viewRelationSchemaForType** > Object viewRelationSchemaForType(type) View relation schema for type ### 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 = RelationsApi(); final type = follows; // String | Type of the schema try { final result = api_instance.viewRelationSchemaForType(type); print(result); } catch (e) { print('Exception when calling RelationsApi->viewRelationSchemaForType: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **type** | **String**| Type of the schema | ### 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)