Search code examples
redmineredmine-api

can't create an issue through Redmine API


I am trying to call the API on our Redmine instance (v 4.2.4.stable), and facing some issues despite following the documentation. I am especially interested in creating issues (https://www.redmine.org/projects/redmine/wiki/Rest_Issues).

This is what I am doing :

POST /issues.json
Content-Type: application/json
X-Redmine-API-Key: xxxx


{
  "issue": {
    "subject": "Subject VF",
    "project_id": 444,
    "tracker_id": 7,
    "status_id": 10,
    "description": "Desc VF"
  }
}

but I get a 422 response, with body :

{
    "errors": [
        "Project cannot be blank",
        "Tracker cannot be blank",
        "Status cannot be blank"
    ]
}

I had initially tried without "subject" in the payload, and was getting the additional "Subject cannot be blank" error. So at least I know that "subject" field is correct.

but why are the other fields seen as blank by the server ? the user has access to the project, and the tracker and status exist, so I really don't understand why it doesn't work


Solution

  • The trick was that the tracker needed to be linked to the project first (in the admin UI). The fact that it existed was not enough.

    Once this is done, then it works.