Content
You are here:
Filtering list of projects using the apis
Added by Hassan Kadhem about 5 years ago
Greetings,
I'm trying to filter projects by a custom filter I defined. Is this possible or is it an enterprise edition feature? I get an error message saying the filter doesn't exist.
same goes for a built-in filter principal
which is listed among the default filters in the api documentation yet I get the same message when I use it.
here is my sample request:
/api/v3/projects?filters=[{ "principal": { "operator": "=", "values": ["hassan "] }}]
btw, I'm using the community edition.
Replies (6)
Hi Hassan,
the principal filter on projects acts as a filter of memberships. The filter value needs to be the principal ID (e.g., user ID), not a string value. It is available in all editions of OpenProject.
For example, to see all projects I'm member of (this will be empty for unauthorized users without the view_members permission)
https://community.openproject.com/api/v3/projects?filters=[{ "principal": { "operator": "=", "values": ["9177"] }}]
Best
Oliver
Oliver Günther wrote:
Hey Oliver, thanks for the reply
still I get the same error even after I put an ID in the values list
is there some API configuration I'm missing? and how about the custom fields? can I filter by them?
I also want to ask about the
memberships
endpoint, I get 404 when I request it .. is it enterprise edition only or what?Are you perhaps using an older version of OpenProject?
Best,
Oliver
I'm using 8.1 , but the api is v3 , it should be the same regardless of open project version right?
Oliver Günther wrote:
No that's not the case. You need to update since project API was added later. APIv3 is not complete yet and there will be new additions in releases.
and will we be able to filter by custom fields in the new version?
Oliver Günther wrote: