Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically download an attachment via Mantis SOAP API?

Successfully using the Mantis SOAP API (aka "MantisConnect") from C#, I can successfully read an issue and also get the download_url field.

When trying to download the attachment by something like this:

using (var request = new WebClient())
{
    request.Credentials = new NetworkCredential("username", "password");

    return request.DownloadData(mantisAtt.download_url);
}

it "downloads" a HTML page with the login screen instead of the binary attachment content.

So my question is:

How can I programmatically download an attachment for an issue in Mantis?

like image 671
Uwe Keim Avatar asked Oct 20 '22 04:10

Uwe Keim


1 Answers

I was on the completely wrong track. Instead of following the download URL being returned I now use the function mc_issue_attachment_get and everything works as expected.

So to solve, do not download from the URL but simply use the intended SOAP API function.

(I found the solution after posting my question to the "mantisbt-soap-dev" mailing list and got a fast reply)

like image 167
Uwe Keim Avatar answered Oct 22 '22 19:10

Uwe Keim