To restrict the output from a project endpoint, you include a filter in the GET /project-service/api/projects
request. The API service uses the operation to filter for a collection of projects to paginate, order, or count your results.
Filter operation examples
The following examples show how to incorporate filter operations into project queries.
Operation | Query |
---|---|
equal | $url/project-service/api/projects?$filter=name%20eq%20'00-TestProject' |
not equal | $url/project-service/api/projects?$filter=name%20ne%20'00-TestProject' |
logical and | $url/project-service/api/projects?$filter=name%20eq%20'00-TestProject'%20and%20sharedResources%20eq%20true |
logical or | $url/project-service/api/projects?$filter=name%20eq%20'00-TestProject'%20or%20sharedResources%20eq%20false |
logical negation | $url/project-service/api/projects?$filter=not%20startswith(name,'00') |
starts with | $url/project-service/api/projects?$filter=startswith(name, '00') |
substring of | $url/project-service/api/projects?$filter=substringof('00', name) |
ends with | $url/project-service/api/projects?$filter=endswith(name, '00') |
length | $url/project-service/api/projects?$filter=length(name)%20eq%205 |
index of | $url/project-service/api/projects?$filter=indexof(name,'00')%20eq%200 |
substring from | $url/project-service/api/projects?$filter=substring(name, 1)%20eq%20'0-Te' |
substring from to | $url/project-service/api/projects?$filter=substring(name, 1, 2)%20eq%20'0-' |
to lower | $url/project-service/api/projects?$filter=tolower(name)%20eq%20'00-testproject' |
to upper | $url/project-service/api/projects?$filter=toupper(name)%20eq%20'00-TESTPROJECT' |
concatenate | $url/project-service/api/projects?$filter=concat(concat(name,','),description)%20eq%20'test project,test project description' |
trim | $url/project-service/api/projects?$filter=trim(name)%20eq%20'00-TestProject' |
Related query examples
The following examples show how to use related query options to paginate, order, or count your results.
If you want to... | Use this request |
---|---|
List the first twenty items | curl -X GET $url/project-service/api/projects?$top=20 -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |
Skip the first ten items in the collection | curl -X GET $url/project-service/api/projects?$skip=10 -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |
List the items in ascending order with asc or descending order with desc. If the type of order is not specified, the list defaults to ascending order. | For ascending order:curl -X GET $url/project-service/api/projects?$skip=0$orderBy=name%20asc -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "."For descending order: curl -X GET $url/project-service/api/projects?$skip=0$orderBy=name%20desc -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |
List the total number of items in the collection. | curl -X GET $url/project-service/api/projects?$count=true -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "." |