Operation value must be an object from issue create for description field

Aanand D September 19, 2018

Not able to create issue with description field. Below is my request

{
"fields": {
"project": {
"key": "SR"
},
"issuetype": {
"name": "Bug"
},
"customfield_10900": {
"value": "Blocker"
},
"customfield_11308": "test@mail.com",
"customfield_11309": "User1",
"customfield_11310": "8563236563",
"summary": "Create Defect",
"description": "Create Description"
}
}

Following request works but the value sent is not getting reflected in JIRA

{
"fields": {
"project": {
"key": "SR"
},
"issuetype": {
"name": "Bug"
},
"customfield_10900": {
"value": "Blocker"
},
"customfield_11308": "aanand.dhandapani@cognizant.com",
"customfield_11309": "User1",
"customfield_11310": "8563236563",
"summary": "asdasdasda",
"description": ["value","Test"],
"customfield_11311": "asdasdasdasd"
}
}

4 answers

1 accepted

5 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2018

Hello,

This line 

"description": ["value","Test"],

means that you are sending an array. It has no meaning for the description field.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2018

I just had a look at Jira Cloud Doc and description is set like this:

"description": {
          "type": "doc",
          "version": 1,
          "content": [
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "description"
                }
              ]
            }
          ]
        },

You can have a look here:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-api-3-issue-post

Like # people like this
Aanand D September 20, 2018

This worked. Thanks a lot.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2018

You are welcome!

felix.weber May 21, 2021

Hi there, 

just to avoid further pitfalls: please be aware in the above example the last character is an colon "," so the JSON data would expect an additional line! 

In case it is the last information you sent remove it !  

 

Below example with Postman to create a issue: 

Please be aware there are differences in API version 2 vs 3, this example is on V3!

POST https://<Jira-Cloud-instance>/rest/api/3/issue

Postman settings

Authentication:

Basic: please be aware in Postman you need your username (usually Email address) and your API code (not the encrypted which you need e.g. using Python!)

Headers: 

Accept: application/json

Content-Type:application/json

Body:

configured as Raw and JSON format:

{
    "fields": {
        "project": {
            "id": "<ProjectID>"
        },
        "issuetype": {
            "id": "<IssueTypeID>"
        },
        "summary": "created via Postman.",
        "description": {
            "type": "doc",
            "version": 1,
            "content": [
                {
                    "type": "paragraph",
                    "content": [
                        {
                            "type": "text",
                            "text": "description"
                        }
                    ]
                }
            ]
        }
    }
}    

Top-Level node type is set to paragraph here (see   )  - even if I don´t know yet where it is documented that the standard description field is a paragraph ;) 

 

1 vote
Rori Stumpf December 19, 2018

It seems that JIRA API v2 defaults to string data type, v3 does not.

v2 will accept the following as a string.

fields: {
    "somefield": "somevalue"
}

v3 of the API will reject with the "Operation value must be an object".

1 vote
Tim Reiking October 24, 2018

I'm having a similar issue on cloud. I have a text field custom field that gives me the same response.

{
"fields": {
"issuetype": {
"id": "10018",
"name": "Problem"
},
"project": {
"id": "10155",
"key": "SERVDEMO"
},
"summary": "Testing Problem from API",
"priority": {
"id": "10000"
},
"description": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Testing Description"
}]
}]
},
"customfield_10031": "Stuff",
"customfield_10046": {
"name": "jira-software-users"
}
}
}

I get the following response:

{
"errorMessages": [],
"errors": {
"customfield_10031": "Operation value must be an object"
}
}

If I change my body to be:

"customfield_10031": {"value": "Stuff"},

 Then my ticket has a value:

image.pngAny help would be great. Thanks.

Alexander Ivkin October 25, 2018

Tim, I've figured, there is a bug in API v3, so if you switch to v2, you will be fine.

Guillermo Andrés Llanquilef Antilen October 25, 2018

Alexander, there is any information about this bug?

Paul Fariello October 26, 2018

Is there an open issue about that?

Alexander Ivkin October 26, 2018
0 votes
Prashant Mali
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2018

Hi @Aanand D ,

First script should work.

Could you please share what is exact response error code?

below is the standard format.

{
    "fields": {
       "project":
       {
          "key": "TEST"
       },
       "summary": "REST ye merry gentlemen.",
       "description": "Creating of an issue using project keys and issue type names using the REST API",
       "issuetype": {
          "name": "Bug"
       }
   }
}

First try with above JSON input data then try to add custom fields related data.

 

Thanks,

Prashant

Aanand D September 20, 2018

This is the response I get

{
"errorMessages": [],
"errors": {
"description": "Operation value must be an object"
}
}

Marc Isikoff March 9, 2023

A lot of this depends on the "type" of field you are setting.

 

For ex, a people picker type such as assignee needs an "ID" even though on a data entry screen it accepts text as typed.

 

So something like this would work:

{

"fields": { "assignee": { "id": {{initiator.accountId.asJsonString}} } }

}

Suggest an answer

Log in or Sign up to answer