ODATA PROTOCOL SUPPORT
What Is OData?
The Open Data Protocol (OData) is a data access protocol based on HTTP and established web methodologies such as REST. Various libraries and tools can be used to access OData services.
The public PLAN-R API partially supports OData v4.0 for retrieving data through GET requests. It allows you to select specific data fields and filter and sort the returned data.
Supported Operators
The public API supports the following OData operators:
- filter — filters returned values. You can use comparison and logical operators and combine expressions using parentheses:
- eq (equal to) — filter=type eq 'project';
- ne (not equal to) — filter=type ne 'version';
- gt (greater than) — filter=createAt gt '2021-01-01';
- ge (greater than or equal to) — filter=createAt ge '2021-01-01';
- lt (less than) — filter=updateAt lt '2022-04-04';
- le (less than or equal to) — filter=updateAt le '2022-04-04';
- and (logical AND) — filter=(type eq 'project') and (createAt ge '2021-01-01');
- or (logical OR) — filter=(date ge '2021-01-01') or (isApproval ne null)
- not (negation): filter=versionStatus not isActive
- select — retrieves only the specified fields;
- orderby — sorts returned values by the specified field. Use asc and desc to specify the sort order;
- asc — sorts in ascending order (the default);
- desc — sorts in descending order;
- apply — uses the extension for aggregating returned data:
- aggregate — aggregates returned data;
- groupby — groups returned data;
- skip — skips the first N results.
- top — returns only the first N results.
Standard Functions
The public API supports OData functions. See the protocol specification for the list of functions.
Custom Functions
The public API implements custom functions that extend OData capabilities:
- getById — returns an attribute's string value by its identifier (getById('Value collection', 'Attribute identifier') => attribute string value). Use this function to retrieve WBS attribute values, directory values, and WBS directory values;
- number — converts a string value to a number (number('5') => 5);
- boolean — converts a string value to a Boolean (boolean('true') => true);
- todatetime — converts a numeric value to a date (todatetime(1787904619000) => 2026-08-28T11:15:30.1234567+03:00);
Retrieving Data
Use the OData select operator to specify the fields you want to retrieve through the API.
Example: Retrieve a list of EPS nodes, including only each node's identifier, name, and type.
curl -X 'GET' \
'https://your-org.domain/public-api/eps?select=type,name,id' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Example: Retrieve a list of WBS nodes where the attribute with the identifier 624b6a37-f6a0-40a5-a2e1-4f2e6724167b equals Hotel building.
curl -X 'GET' \
'https://your-org.domain/public-api/wbs?epsId=70d6cb44-00e9-4535-9949-2d5596f0988a&filter=getById(values, '624b6a37-f6a0-40a5-a2e1-4f2e6724167b') eq 'Hotel building'' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 507' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Example: Retrieve a list of WBS nodes where the attribute with the identifier 624b6a37-f6a0-40a5-a2e1-4f2e6724167b is greater than 10.
curl -X 'GET' \
'https://your-org.domain/public-api/wbs?epsId=70d6cb44-00e9-4535-9949-2d5596f0988a&filter=number(getById(values, '624b6a37-f6a0-40a5-a2e1-4f2e6724167b')) gt 10' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 507' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Filtering Data
Use the filter operator to filter retrieved data. The response includes only data that matches the specified filter conditions.
Example: Retrieve a list of EPS nodes of type project, including only each node's identifier, name, and type.
curl -X 'GET' \
''https://your-org.domain/public-api/eps?select=type,name,id & filter=type eq 'project''' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Example: Retrieve a list of WBS records whose Start attribute falls in 2027. The todatetime function is available starting with version 608.
- getById(values, '00000000-0000-4000-8000-000000000003') — retrieves the date from the system Start attribute as a string;
- number(getById(values, '00000000-0000-4000-8000-000000000003')) — converts the value to a number;
- todatetime(number(getById(values, '00000000-0000-4000-8000-000000000003'))) — converts the number to a date;
- year(todatetime(number(getById(values, '00000000-0000-4000-8000-000000000003')))) eq 2027 — extracts the year from the date and checks whether it equals 2027.
curl -X 'GET' \
'http://your-org.domain/public-api/wbs?EpsId=1ca2d742-620e-417e-a327-b6d112213ad4&%24filter=year%28todatetime%28number%28getById%28values%2C%20%2700000000-0000-4000-8000-000000000003%27%29%29%29%29%20eq%202027' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 608' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Sorting Data
Use orderby to sort data in ascending order with ASC (the default) or in descending order with DESC.
Example: Retrieve a list of EPS nodes of type project whose project name starts with "Ст", including only each node's identifier, name, and type. Sort by sortOrder.
curl -X 'GET' \
''https://your-org.domain/public-api/eps?select=type,name,id & filter=type eq 'project' and startsWith(name, 'Ст') & orderby=sortOrder desc '' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Data Pagination
The server returns no more than 100 records matching the query conditions per request. Use top and skip to paginate the results. skip skips the specified number of records, and top specifies how many records to return.
Example: Sort EPS by sortOrder and retrieve two matching nodes, skipping the first four.
curl -X 'GET' \
'https://your-org.domain/public-api/eps?orderby=sortOrder desc & $top=2 & $skip=4' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Example: Retrieve the number of EPS elements.
curl -X 'GET' \
'https://your-org.domain/public-api/eps?apply=aggregate($count as eps_count)' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Example: Retrieve the number of EPS elements of type version.
curl -X 'GET' \
'https://your-org.domain/public-api/eps?apply=filter(Type eq 'version')/aggregate($count as eps_count)' \
-H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
-H 'x-version: 409' \
-H 'Authorization: your-api-key' \
-H 'x-tenant-id: 5db13376-ba5c-4fd5-ba7f-dc56347956ad'
Attention!
For detailed information about using OData, see the official Basic Tutorial. For detailed information about using OData for data aggregation, see OData Extension for Data Aggregation Version 4.0.