We are receiving the below error when we try to upload a .csv file to an already existing JIRA ticket. The ID which we are using has the necessary privilege to create and update JIRA tickets.
Error message: Exception calling "UploadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found.".Exception.Message
Exception Item : Exception calling "UploadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found.".Exception.ItemName
We are calling rest api using the below PowerShell script:
Param($JiraUserId,$DecryptedPassword,$JiraTicket,$Filepath,$JiraURL)
Try { $Url=$JiraURL $UserID=$JiraUserId
$Password=$DecryptedPassword
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("
{0}:{1}"
-f $UserID, $Password)))
$headers = New-Object
"System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Authorization',('Basic {0}
' -f $base64AuthInfo))
$headers.Add('Accept','application/json')
$headers.Add('Content-Type','application/json') $JiraRest = new-object
System.Net.WebClient $JiraRest.Headers.Add("Authorization",
$headers.Authorization) $JiraRest.Headers.Add("X-Atlassian-Token",
"nocheck") $UploadState=$JiraRest.UploadFile("$Url/$JiraTicket/attachments",
$Filepath)
@Sai Krishna Can you check if the JIRA user with which you are attempting this, has "Create Attachments" permission in the relevant JIRA project?
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.