update issue components with REST API

lasith gunawardana July 11, 2013

im working on creating and editing issues with API, looking for add issue components, what i am doing here passing array with selected component id's.

this is my array

array(
   0 => '10000',
   1 => '1212',
)

but request JSON expecting somthing like this in components section,

{
       "fields": {
                "project": {
                "id": "10000"
                },
                "summary": "'te'te",
                "description": "e'reserg",
                "issuetype": {
                "id": "1"
                },
                "priority": {
                "id": "1"
                },
                "components": [{
                "id": "10000"
                }]
            }
     }

how can i add my id's to this JSON array?

any help?

thanx in advance

1 answer

1 accepted

0 votes
Answer accepted
RambanamP
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.
July 11, 2013

check the sample codes here

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Edit+issues#JIRARESTAPIExample-Editissues-Addingacomponent

your code need to modified something like this

{
       "fields": {
                "project": {
                "id": "10000"
                },
                "summary": "'te'te",
                "description": "e'reserg",
                "issuetype": {
                "id": "1"
                },
                "priority": {
                "id": "1"
                },
                "components": [{
                "id": "10000"
                },
				{
				  "id": "1212"
				}
				]
            }
     }

Suggest an answer

Log in or Sign up to answer