Hi, I have a problem downloading the attachment (file) from the REST API JIRA on-prem response:
Example url:
https://domain.com/jira/secure/attachment/{id}/{file_name}
This is my CSharp (C #) code:
var client = new RestSharp.RestClient("https://jira_domain.pl/secure/attachment/1234567/file_name.doc");
client.Timeout = -1;
var request = new RestSharp.RestRequest(Method.GET);
request.AddHeader("Authorization", String.Format("Basic {0}", Secret));
response = client.Execute(request);
fileBytes = client.DownloadData(request);
I used the Invoke Method activity to write a byte array (byte[]
) to a file. The file writes, but instead of 1.11MB, it only has 4KB.
When I perform the same query using cURL in Postman:
curl -L -O -k -u 'user:pass' -X GET https://jira_domain.pl/secure/attachment/1234567/file_name.doc
I have the option to save the attachment via the Save Response> Save to a file option:
File saved by Postman:
File saved by Invoke Method:
Both IRestResponse.RawBytes As Byte []
and fileBytes As Byte [] = client.DownloadData(request)
have the same number of bytes:
What’s the problem?
Why is Postman able to save the file and my code not?