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. Set status of existing ticket via API

Set status of existing ticket via API

Added by Jonah Sundahl about 5 years ago

Hi, I'm trying to figure out how to set the status of an existing ticket via the API. I'm using the PATCH /api/v3/work_packages/<wp number> endpoint, which I can get a 200 from (and edit fields like the title), it just doesn't update the status at all. So far the bodies I have tried are as follows:

Any help is appreciated, thanks!

Note: "-----" delimits different bodies, and they all are passed
with "lockVersion" and complete with status code 200
------

"_embedded": {
	"status": {
		"id": 7,
		"name": "Implementation",
		"isClosed": false,
		"color": "#66D9E8",
		"isDefault": false,
		"isReadonly": false,
		"defaultDoneRatio": null,
		"position": 4
	}
}
    
------

"_links": {
	"status": {
        "href": "/api/v3/statuses/7",
        "Title": "Implementation"
    }
}

-------

both of the above combined into one body as siblings, and just the "status" child of "_embedded"

------

"status": "Implementation"

------

"status": 7

------

"status": { "id": 7 }

Replies (2)

RE: Set status of existing ticket via API - Added by Oliver Günther about 5 years ago

Hi Jona,

To change only the status to the one with ID 7, execute the patch with the following body:

{
  "lockVersion": 123,
  "_links": {
  	"status": { "href": "/api/v3/statuses/7" }
  }
}

The lockVersion value must correspond to the value you got from the API request. It's an optimistic locking approach to ensure you are the working on the last state of the work package.

Best

Oliver

RE: Set status of existing ticket via API - Added by Jonah Sundahl about 5 years ago

that worked, thanks oliver!

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