Vince
Vince

Reputation: 1527

REST-request yields error because Jira thinks that required field is missing

I'm trying to create a Jira-issue via REST. My request looks like this:

Method: POST
Content-Type: application/json
Body: '{"fields":{"project":"ID"}}'

The response I get looks like this

{"errorMessages":[],"errors":{"project":"project is required"}}

which is strange, since I'm providing a project in my request. Does anyone see what I'm missing here?

Upvotes: 1

Views: 2898

Answers (1)

vzamanillo
vzamanillo

Reputation: 10554

Seems like you are sending an incorrect JSON to JIRA, according to JIRA documentation an issue is formed like

"fields": {
    "project": {
        "id": "10000"
    },
    "summary": "something's wrong",
    "issuetype": {
        "id": "10000"
    },
    "assignee": {
        "name": "homer"
    }
}

but you are sending

{
    "fields": {
        "project": "ID"
    }
}

Upvotes: 1

Related Questions