These are chat archives for opf/openproject

20th
Aug 2015
Vladimir K
@cronacronis
Aug 20 2015 09:47
Good morning everybody. Me again. Has switched to v2 API. Docs are quite poor. Could you please point me to an example how to create work_package? I receive following
This message was deleted
{
    "errors": {
        "type": [
            "can't be blank"
        ],
        "type_id": [
            "is not set to one of the allowed values"
        ]
    }
}
POST JSON
{
    "planning_element": {
    "subject": "Bug in front page"
    }
}
to following address:
http://192.168.44.187/api/v2/projects/3/planning_elements.json?key=......
Jan Sandbrink
@NobodysNightmare
Aug 20 2015 09:55
okay, seems you are doing the right thing...
But you will also need to specify a type for your work package
(btw. APIv3 will assume a default type IIRC)
Azure7111
@Azure7111
Aug 20 2015 09:56
It does indeed
Jan Sandbrink
@NobodysNightmare
Aug 20 2015 09:56
However, the docs we pointed you to are the only ones available. I realize that they are quite poor. There is a lot of guesstimation work neccessary :/
Vladimir K
@cronacronis
Aug 20 2015 10:09
@NobodysNightmare where I can find type possible values? type_id is visible :)
Jan Sandbrink
@NobodysNightmare
Aug 20 2015 10:12
let me guess...
api/v2/planning_element_types.json
or better: /api/v2/projects/:id/planning_element_types.json
those are the ones available in your current project
I am out for lunch, see you later ^^
Vladimir K
@cronacronis
Aug 20 2015 10:22
Bon appetit! ;)
{
    "planning_element_types": [
        {
            "id": 1,
            "name": "Task",
            "in_aggregation": false,
            "is_milestone": false,
            "position": 1,
            "is_default": true,
            "color": {
                "id": 12,
                "name": "Grey",
                "hexcode": "#EAEAEA"
            },
            "created_at": "2015-08-14T09:24:12Z",
            "updated_at": "2015-08-14T09:24:12Z"
        },
        {
            "id": 2,
            "name": "Milestone",
            "in_aggregation": true,
            "is_milestone": true,
            "position": 2,
            "is_default": false,
            "color": {
                "id": 4,
                "name": "Green (light)",
                "hexcode": "#35C53F"
            },
            "created_at": "2015-08-14T09:24:12Z",
            "updated_at": "2015-08-14T09:24:12Z"
        },
        {
            "id": 7,
            "name": "Bug",
            "in_aggregation": false,
            "is_milestone": false,
            "position": 7,
            "is_default": false,
            "color": {
                "id": 8,
                "name": "Red",
                "hexcode": "#FF3300"
            },
            "created_at": "2015-08-14T09:24:12Z",
            "updated_at": "2015-08-14T09:24:12Z"
        }
    ]
}
Still receive the same error for following request:
{
    "planning_element": {
        "subject": "Bug in front page",
        "type": "Task",
        "type_id": 1
    }
}
Vladimir K
@cronacronis
Aug 20 2015 10:53
Works that way:
{
    "planning_element": {
        "subject": "Bug in front page",
        "type_id": 1
    }
}
Jan Sandbrink
@NobodysNightmare
Aug 20 2015 11:06
great you could figure that out... I did not see the problem at first glance ^^