REST API - Filter Parameter
11 min
the filter parameter allows you to narrow the results that are included in the response to your request if no filter parameters are specified, all artifacts are returned if a filter parameter is specified, artifacts are only returned if the artifact matches the specified criteria the filter parameters can be used individually, or combined to narrow results further syntax the filter parameter must be specified using the following syntax filter={artifact id eq (‘1’ or ‘2’ or ‘3’);artifact type eq (‘actor’);artifact hascomments eq ‘true’;property 'my prop' eq 1;property my2prop eq (‘my name’ or ‘your name’)} method the filter parameter must be submitted using the rest api http post method docid\ hsi lzxs8g rx ydudzkg to submit information using the http post method, you must add the following information to the request header to override the get method x http method override get then, include your filter parameter in the request body for example filter={artifact type eq (‘ui mockup'); parameters artifact id if specified, artifacts are only returned if the id of the artifact matches one of the given ids artifact type if specified, artifacts are only returned if the artifact type matches one of the given artifact types artifact hasattachments if set to true, artifacts are only returned if there is at least one associated attachment if set to false, artifacts are only returned if there are no associated attachments artifact hascomments if set to true, artifacts are only returned if there is at least one associated comment if set to false, artifacts are only returned if there are no associated comments property \[name] if specified, artifacts are only returned if the artifact's property value matches the given value supported operators the supported operators varies depending on the data that you want to query the table below outlines the supported operators for each type of data tips and important notes filtering on users and groups when filtering on a user, you must use the user id prepended with the letter 'u' for example, if the user id was 20, you need to specify 'u20' when filtering on a group, you must use the group id prepended with the letter 'g' for example, if the group id was 18, you need to specify 'g18' filtering on dates and audit datetime dates are measured using just the date (example '2013 05 11') while author history fields ('created on' and 'last edited on') are measured using nano seconds (example '2013 01 22t16 08 14 2170000z') because of this difference, if you perform a greater than ('gt') filter, the results will be different for example, a greater than operation on a date will return artifacts that match the following day alternatively, a greater than operation on the 'created by' field will return artifacts after midnight on the same day filtering on custom properties if you are filtering on custom properties, you must include quotations around the property name if it includes a space for example property 'focus group' examples retrieve all artifacts that have associated comments filter={artifact hascomments eq (‘true’);} retrieve all artifacts of type 'actor' filter={artifact type eq (‘actor’);} retrieve all artifacts of either type 'actor' or 'use case' filter={artifact type eq ('use case' or 'actor');} retrieve all artifacts of type 'textual requirement' that have at least one attachment filter={artifact type eq ('textual requirement'); artifact hasattachments eq ('true');} retrieve all artifacts where the priority property of the artifact is set to 'high' filter={property priority eq ('high');} retrieve all artifacts where the focus group property of the artifact is equal to a group with an id of 9 or 10 filter={property 'focus group' eq ('g9' and 'u10')} retrieve all artifacts that were last edited between midnight on may 11th and midnight on may 14th inclusive filter={property 'last edited on' bi ('2013 05 11' and '2013 05 14')} retrieve all artifacts that were created after midnight on may 14th filter={property 'created on' gt ('2013 05 14')}