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. API - Get tasks filtered by version

API - Get tasks filtered by version

Added by Petr Zeman over 5 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...