Hi, I am trying to add attachments while creating the issue using rest/api/3/issue? api.
{ "issueUpdates": [
{
"fields": {
"summary": "string",
"issuetype": {
"name": "Epic"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "string",
"type": "text"
}
]
}
]
},
"project": {
"key": "SP"
},
"attachment": [
{
"id": "10003",
"filename": "Jira.json",
"author": {
"self": "https://jb-saurabh.atlassian.net/rest/api/3/user?accountId=5c25230db393bf4ce955eb2c",
"accountId": "5c25230db393bf4ce955eb2c",
"emailAddress": "saurabh.bhandari@jitterbit.com",
"avatarUrls": {
"48x48": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5c25230db393bf4ce955eb2c/46526343-ea20-4917-a41c-fcb740972a27/48",
"24x24": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5c25230db393bf4ce955eb2c/46526343-ea20-4917-a41c-fcb740972a27/24",
"16x16": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5c25230db393bf4ce955eb2c/46526343-ea20-4917-a41c-fcb740972a27/16",
"32x32": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5c25230db393bf4ce955eb2c/46526343-ea20-4917-a41c-fcb740972a27/32"
},
"displayName": "Saurabh Bhandari",
"active": true,
"timeZone": "Asia/Calcutta",
"accountType": "atlassian"
},
"created": "2021-05-19T12:37:24.332+0530",
"size": 155883,
"mimeType": "application/json",
"content": "https://jb-saurabh.atlassian.net/secure/attachment/10003/Jira.json"
}
] } } ]
}
And I am getting the below error :
{
"issues": [],
"errors": [
{
"status": 400,
"elementErrors": {
"errorMessages": [],
"errors": {
"attachment": "string expected at index 0"
} },
"failedElementNumber": 0
}
]
Can anyone please help me out to find the current payload
Thanks
That is correct, you cannot add an attachment at the time of creating an issue. What you need to do is make a note of the issue key when you create it, then run another API call to add the attachment. I give some C# code in my answer to this post which may help you
thanks @Warren for your reply, But I am getting this attachment node when I request for metadata using rest/api/3/issue/createmeta?projectKeys=SP&issuetypeNames=Epic&expand=projects.issuetypes.fields for creating a issue
In response, I am getting node for attachment as :
"attachment": {
"required": false,
"schema": {
"type": "array",
"items": "attachment",
"system": "attachment"
},
"name": "Attachment",
"key": "attachment",
"hasDefaultValue": false,
"operations": [
"set"
]
}
I think this means we can have attachment data in create issue request.
Please correct me I am doing something wrong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.