SOAP API: Programmatically downloading an attachent?

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
uwekeim
Posts: 3
Joined: 28 Jul 2014, 07:33
Contact:

SOAP API: Programmatically downloading an attachent?

Post by uwekeim »

Successfully using the SOAP API 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:

Code: Select all

using (var request = new WebClient())
{
	request.Credentials = new NetworkCredential(_settings.UserName, _settings.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?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: SOAP API: Programmatically downloading an attachent?

Post by atrol »

I recommend to write also to mantisbt-soap-dev mailing list for such kind of questions
http://www.mantisbt.org/mailinglists.php
Please use Search before posting and read the Manual
uwekeim
Posts: 3
Joined: 28 Jul 2014, 07:33
Contact:

Re: SOAP API: Programmatically downloading an attachent?

Post by uwekeim »

What is this "mailing list" thing, and why do you think he knows more than the visitors of this forum?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: SOAP API: Programmatically downloading an attachent?

Post by atrol »

Not sure what you mean with your question.
Did you read the section "SOAP API Mailing List" on the page where I provided the link?

I am quite sure that one of the main authors of the SOAP API will read your question if you write to the mailing list as they subscribed to this list.
They are not reading all posts in forum.
Please use Search before posting and read the Manual
uwekeim
Posts: 3
Joined: 28 Jul 2014, 07:33
Contact:

Post by uwekeim »

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.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: SOAP API: Programmatically downloading an attachent?

Post by atrol »

Thanks for coming back and telling the solution.
Please use Search before posting and read the Manual
Post Reply