Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create jira issue with insigh field (Cloud)

Lewis Martins April 5, 2022

Having some trouble here and can only find documentation for the server API.  I am simply trying to set an insight field when creating an issue via the Jira create api

/rest/api/3/issue

https://community.atlassian.com/t5/Jira-Software-questions/Not-work-link-for-documentation-about-Insight-RESt-API/qaq-p/1795302

https://confluence.atlassian.com/insightapps/insight-with-jira-rest-api-1085180905.html 

 

Both of the above say to use the following syntax...

{
    "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": "Task"
       },
       "customfield_10100" : [{"key" : "TEST-1"}],
       "customfield_10200" : [{"key" : "TEST-1"}, {"key" : "TEST-2"}]
   }
}

 

So I submitted the following:

{
    "fields": {
        "customfield_10098": {
            "value""5 Lowest Impact"
        },
        "customfield_10118": {
            "id""10367"
        },
        "customfield_10148""12345",
        "customfield_10236": {
            "id""11332"
        },
        "description": {
            "content": [
                {
                    "content": [
                        {
                            "text""job abended",
                            "type""text"
                        }
                    ],
                    "type""paragraph"
                }
            ],
            "type""doc",
            "version"1
        },
        "issuetype": {
            "name""Batch Abend"
        },
        "project": {
            "key""AST"
        },
        "reporter": {
            "id""61df53ffe76379006871f360"
        },
        "summary""job abended please fix",
        "customfield_10010""82",
        "customfield_10332": [{"key" : "CUS-63"}]
    }
}

 

The issue gets created but there is no value in the insight object field.  All other data is there (including Request Type which is 10010).  I tried a number of other things as well (all accepted with a 201 return code):

        "customfield_10332": [{"key" : "CUS-63"}]
        "customfield_10332": [{"key" : "63"}]
        "customfield_10332": [{"objectId" : "63"}]
        "customfield_10332": [{"objectId" : "CUS-63"}]
        "customfield_10332": [{"name" : "object name"}]
        "customfield_10332": [{"Id" : "CUS-63"}]
 
        "customfield_10332": [{"Id" : "63"}]

  

I am sure I have the correct custom field number as I got the 'not on the screen' message at first before I added the field to the screen.  Also here it is via the custom field screen:

customer_custom_field_number.png

 

So is there a difference in the cloud syntax?  Is there something wrong here that I just can't see?  Is there a different API I should be using? 

I looked through the JSM API but nothing stood out https://developer.atlassian.com/cloud/jira/service-desk/rest/intro/ 

1 answer

1 accepted

2 votes
Answer accepted
Fernando Eugênio da Silva
Community Champion
April 5, 2022

Hey, @Lewis Martins .

Please, verify if this answer helps to you: https://community.atlassian.com/t5/Jira-Service-Management/JSON-body-example-that-links-an-Insight-object-to-a-JSM-issue/qaq-p/1986713#M101743

 

"customfield_XXXXX": [
{
"workspaceId": "WORKSPACE_ID",
"id": "WORKSPACE_ID:OBJECT_ID(NUMBER)",
"objectId": "OBJECT_ID"
}
]

How to get WorkSpaceID:

Access the URL: https://URL/rest/servicedeskapi/insight/workspace;

Collect the ID present in “WorkspaceId”.

How to get the ObjectID:

Access the insight and go to the desired object;

The “Object_ID” number is the numbering information that follows the object's key in Insight.

 

Kind Regards,

Fernando

Lewis Martins April 7, 2022

Thanks @Fernando Eugênio da Silva  that worked perfectly.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events