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

General discussion
  1. OpenProject
  2. Forums
  3. General discussion
  4. How to set up filters (API)

How to set up filters (API)

Added by masayuki ogawa over 1 year ago

I'm using the API to get work_packages.

The following documentation describes filters, but it does not work well. https://www.openproject.org/docs/api/endpoints/work-packages/

How do I set this up? (I can get the value if I don't specify filters)

  • code
import requests
host_url = "MY_HOST_URL"
api_url = host_url + '/api/v3/'
api_key = "MY_API_KEY"
work_packages_url = api_url + "work_packages"

filters = [{ "start_date": { "operator": ">", "values": ["2024-01-01"] }}] # it's not work.

params = {'pageSize':100, 'offset':0, 'filters':filters}
response = requests.get(work_packages_url, auth=('apikey',api_key), params=params)
data = response.json()
data
  • response
{'_type': 'Error',
 'errorIdentifier': 'urn:openproject-org:api:v3:errors:InvalidQuery',
 'message': "859: unexpected token at 'start_date'"}

Replies (1)

RE: How to set up filters (API) - Added by Daewon Kim 8 months ago

I have the exactly the same problem.

API documentation is lacking.

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