Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Development
  1. OpenProject
  2. Forums
  3. Development
  4. Filtering list of projects using the apis

Filtering list of projects using the apis

Added by Hassan Kadhem over 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)

RE: Filtering list of projects using the apis - Added by Oliver Günther over 5 years ago

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

RE: Filtering list of projects using the apis - Added by Hassan Kadhem over 5 years ago

Oliver Günther wrote:

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

Hey Oliver, thanks for the reply

still I get the same error even after I put an ID in the values list 

{
    "_type": "Error",
    "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidQuery",
    "message": [
        "Filters Principal does not exist."
    ]
}

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?

RE: Filtering list of projects using the apis - Added by Oliver Günther over 5 years ago

Are you perhaps using an older version of OpenProject?

Best,

Oliver

RE: Filtering list of projects using the apis - Added by Hassan Kadhem over 5 years ago

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:

Are you perhaps using an older version of OpenProject?

Best,

Oliver

RE: Filtering list of projects using the apis - Added by Oliver Günther over 5 years ago

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.

RE: Filtering list of projects using the apis - Added by Hassan Kadhem over 5 years ago

and will we be able to filter by custom fields in the new version? 

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.

  • (1 - 6/6)
Loading...