Uwe Keim
Uwe Keim

Reputation: 40726

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?

Upvotes: 5

Views: 1133

Answers (1)

Uwe Keim
Uwe Keim

Reputation: 40726

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)

Upvotes: 3

Related Questions