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. [Solved] Work Order created with API are always set with the same Type

[Solved] Work Order created with API are always set with the same Type

Added by Michael Lathion almost 10 years ago

Hello,
I’m trying to develop a small application to create work order thru API v3 under Open Project 4.3.0-alpha.

When I send the following request with curl :
curl -u apikey:APIKEY -H “Content-type: application/json” -X POST -d “{”subject“:”monsujet“, ”type“:{”href“:”/api/v3/types/2“,”title“:”Task“}}” https://MYPROJECT.openproject.com/api/v3/projects/2/work_packages

The work order is created with the right subject but with the default type 4 (Milestone) instead of the type 2 Task.

Isn’t that the right way to define the type ?

How should I do ?

Thanks


Replies (2)

RE: Work Order created with API are always set with the same Type - Added by Alexander Bach almost 10 years ago

Hi,

I have to admit that I ran into this issue myself. You almost got it right though. In order to set linked properties you need to enclose them in _links

Have a look at the 200 response of http://opf.github.io/apiv3-doc/#work-packages-workpackage-get to know how to format properties.

Also: If you found a nice spot to add this as a hint to the APIv3 documentation, don’t hesitate to create a pull request ;)

Regards,
Alex

RE: Work Order created with API are always set with the same Type - Added by Michael Lathion almost 10 years ago

Hi,
Thanks, I finally found it by myself after some trials and errors (took me about 1 complete day but I’m not an experienced programmer ;) ).
I’ll try to mak a pull request on the documentation, I think the best is to add a remark in the Link object section.
Best regards, and thanks for the good job on this software!
PS: sorry for posting from another account but I have issues connecting with the Google authentification method.

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