Download URL as XML: Error 400 Bad Request

201 views Asked by At

I have a process that downloads ECB XML yield curve data automatically through VB.net. The ECB is changing their XML format soon, so I'm updating my process to read from the new format. When I try to download the new XML info, I get

The remote server returned an error: (400) Bad Request.

From research, it seems like there has to be something wrong with the format of my request, but I can't figure it out.

The only change is the URL I'm referencing. For both, if you enter them into a browser, you are taken to XML data. However, the new format URL takes a couple minutes to load, but is roughly the same size as the old format which loads almost instantaneously.

Thoughts?

Current, working code:

Public WithEvents WC as New System.Net.WebClient

WC.DownloadFile("http://www.ecb.europa.eu/stats/money/yc/data/fmd/download_old/yc_latest.xml?", FilePath)

New, non-working code:

Public WithEvents WC as New System.Net.WebClient

WC.DownloadFile("https://sdw-wsrest.ecb.europa.eu/service/data/YC/B.U2.EUR.4F.G_N_A+G_N_C.SV_C_YM.?lastNObservations=1", FilePath)
0

There are 0 answers