Forums

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

How can I add asset objects during ticket creation process via the api?

Debabrata Pramanik August 10, 2023

Hi I am unable to add an asset object custom field during ticket creation. I am sending the payload as following and am using the /rest/api/2/issue endpoint. Although after ticket creation I am able to select one option from the custom field dropdown and set it in the UI. In the UI I don't see it in the create ticket modal. Is that the reason ? Also there are not errors, JIRA response is fine, but the customfield array is empty. Thanks

{
    "fields": {
       "project":
       {
          "key": "TEST"
       },
       "summary": "Test summary",
       "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"}]
   }
}  

 

2 answers

1 accepted

1 vote
Answer accepted
Fernando Eugênio da Silva
Community Champion
August 15, 2023

@Debabrata Pramanik 

Try to pass this payload for Assets Custom Field

 "customfield_XXXX": [
{
"workspaceId": "XXXXX",
"Id": "WORKSPACEID:OBJECTID_NUMBER",
"objectId": "OBJECTID"
}
],

How to get WorkspaceID:

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

Collect the ID present in workspaceID

How to get ObjectID:

Access the Assets and go to the desired object. The ObjectID is the number that follows the object key in assets.

I know it's hard :(

Hope this helps you

0 votes
Debabrata Pramanik August 15, 2023

Thanks. Yes that worked. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events