Entity Filtering
Specify entity filters in the form of endpoint query parameters to restrict the contents of endpoint responses to objects that match particular criteria. For example, to ensure the /restapi/<resourcename>
endpoint only returns objects with a status of Not Started, add a Status:eq:'Not Started'
query parameter to the requested endpoint: /restapi/<resourcename>?Filter=Status:eq:'Not Started'
.
The P6 REST API supports several entity filtering options. The following table lists supported entity filter operations:
Name | Operator | Description | URL Encoded Operator | Examples |
Equals | :eq: | Excludes response objects that do not contain properties with values matching the value specified in the filter parameter. | %3Aeq%3A | Only return objects with an ObjectId value of 1001: URL encoded form: |
Does not Equal | != | Only includes response objects that contain properties with values that do not match the value specified in the filter parameter. | !%3D | Only return resources with ObjectId values that are not equal to 1001: URL encoded form: |
Less than or Equal to | :lte: | Include response objects that contain properties with values less than or equal to the value specified in the filter parameter. This filter operation supports numeric and date values. |
%3Alte%3A | Only return resources with ObjectId values less than or equal to 88578: URL encoded form: |
Greater than or Equal to | :gte: | Include response objects that contain properties with values greater than or equal to the value specified in the filter parameter. This filter operation supports numeric and date values. |
%3Agte%3A | Only return resources with ObjectId values greater than or equal to 88578: URL encoded form: |
Less than | :lt: | Include response objects that contain properties with values less than the value specified in the filter parameter. This filter operation supports numeric and date values. |
%3Alt%3A | Only return resources with ObjectId values less than 88578: URL encoded form: |
Greater than | :gt: | Include response objects that contain properties with values greater than the value specified in the filter parameter. This filter operation supports numeric and date values. |
%3Agt%3A | Only return resources with ObjectId values greater than 88578: URL encoded form: |
Combining Filters
You can combine entity filters using logical operators. For example, the /restapi/activity?Filter=ObjectId:eq:88577 :and: Name :like: 'Ensure%' endpoint combines ObjectId and Name value filters using a logical AND. The following table lists supported logical operators for combining entity filters.
Name | Operator | Description | Examples |
AND | :and: | The logical AND operator restricts response objects to entities that match all specified filter values. | Only return objects with ObjectId values of 88577 and Name matching values of 'Ensure': /restapi/activity?Fields=Name,ObjectId&Filter=ObjectId:eq:88577 :and: Name :like: 'Ensure%' URL encoded form: |
OR | :or: | The logical OR operator restricts response objects to entities that match one or more of the specified filter values. | Only return objects with ObjectId values of 88577 or 88578: URL encoded form: |
Wildcards
Use wildcard entity filters to limit response objects based on textual patterns. For example, the /restapi/activity?Fields=Name,ObjectId&Filter=Name :like: 'Act1%'
endpoint returns resource objects containing a activityName value of "Act1" followed by any string. The following table lists supported entity filter wildcards:
Name | Operator | Description | Examples |
Any String | :like: | The Any String wildcard matches any string value of one or more characters. This filter operation only supports the string and enum data types. You can only use a wildcard to match textual patterns within a string. |
Find any values that start with "act": URL encoded form:
Find any values that end with "act": URL encoded form:
Find any values that have "act" in any position: URL encoded form: |