Hello Nigel,
We worked with IBM support guys and find decision of problem to attach file in Jira Case.
I share script here if someone need it :)
defVar --name multipart
--type HttpContent
defVar --name sucess
--type Boolean
defVar --name cred
--type String
defVar --name dictionary
--type StringDictionary
--innertype String
defVar --name fileContent
--type HttpContent
defVar --name response
--type String
defVar --name statusCode
--type Numeric
defVar --name RP
--type String
defVar --name headers
--type StringDictionary
--innertype String
defVar --name ContentHeaders
--type StringDictionary
--innertype String
strDictAdd --key "X-Atlassian-Token"
--value "no-check"
--dictionary ${dictionary}textToBase64 --source "username:JiraToken"
--encoding "UTF8" sucess=success cred=value
logMessage --message "Success:
${sucess} encoded:
${cred}"
--type "Info"
strDictAdd --key Authorization
--value "Basic
${cred}"
--dictionary ${dictionary}createHttpContent --formattype "Bytes"
--file PathToFile fileContent=value
createHttpContent --formattype "Multipart"
--contentlist "file=
${fileContent}" multipart=value
httpRequest --verb "Post"
--url "
https://econtexpress.atlassian.net/rest/api/latest/issue/AO-127217/attachments" --headers ${dictionary} --formatter "Instance"
--source "
${multipart}"
--cookiecontainer --comment "https://econtexpress.atlassian.net/rest/api/latest/issue/AO-127217/attachments " sucess=success response=value statusCode=statusCode RP=reasonPhrase headers=headers ContentHeaders=contentHeaders
logMessage --message "\r\n----------------------------------------------\r\nSucess:
${sucess}\r\nResponse:
${response}\r\nStatusCode:
${statusCode}\r\nRP:
${RP}\r\nHeaders:
${headers}\r\nContentHeaders:
${ContentHeaders}\r\n-----------------------------------------------------------"
--type "Info"
------------------------------
IVO STOIMENOV
------------------------------
Original Message:
Sent: Tue April 12, 2022 12:53 PM
From: NIGEL CROWTHER
Subject: Attach file by API using HTTP Request activity
Hi Ivo,
Check out the code in the library here:
REST API upload PDF
Hopefully, this will show you how to do it.
------------------------------
NIGEL CROWTHER
Original Message:
Sent: Mon April 11, 2022 04:14 AM
From: IVO STOIMENOV
Subject: Attach file by API using HTTP Request activity
Hello,
I need some help by attach a file in Jira system using "HTTP Request".
I need to know which are mandatory "Headers" and "Content Headers" which I need to use when I try to attach a different type of files using this activity.
And if it is possible to show me their properties for attaching .txt file to test the example.
When I try to run activity with parameters I have set the "Reason Phrase" returns: Unsupported Media Type --->error 415

Thanks for your time :)
------------------------------
IVO STOIMENOV
------------------------------