Top Menu

Jump to content
    Global modules

    Global modules

    • Home
    • Projects
    • Activity
    • Work packages
    • Gantt charts
    • Calendars
    • Team planners
    • Boards
    • News
    Home
    Home
Help
    Getting started
    • Introduction video
  • 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

User menu

Sign in
Forgot your password?

or sign in with your existing account

OpenProject ID Google

Side Menu

Collapse project menu

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

Content

Expand project menu
General discussion
  1. OpenProject Community
  2. OpenProject
  3. Forums
  4. General discussion
  5. API - Get tasks filtered by version

API - Get tasks filtered by version

Added by Petr Zeman almost 6 years ago

Hi.
I am trying to use API to get all work packages with no version set.
As result I'm getting error:
{
"_type": "Error", "errorIdentifier": "urn:openproject-org:api:v3:errors:InternalServerError",
"message": "An internal error has occured. undefined method `keys' for ["n", "version"]:Array"
}

According to API documentation I tried to gather filter from URL in browser with listed packages:
{"n":"version","o":"!*"}

Is there a way, how to get such filtered list using API?


Replies (1)

RE: API - Get tasks filtered by version - Added by Petr Zeman over 5 years ago

Simple example of extracting IDs of packages with no version assigned.

for id in $(curl -s -u apikey:YOUR_KEY 'https://HOST/api/v3/work_packages?filters=%5B%7B%22version%22%3A%7B%22operator%22%3A%22%21%2A%22%2C%22values%22%3A%5B%5D%7D%7D%5D' | jq '._embedded  .elements | to_entries[] .value .id'); do 
	echo ID $id;
done
  • (1 - 1/1)
Loading...