(405) Method Not Allowed

When I try to update my feed from a .net application I get the error:

System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.

I do a simple put with the data "test". This is the code:


byte[] postArray = Encoding.ASCII.GetBytes("test");
WebClient wc = new WebClient();
wc.UploadData("http://www.pachube.com/api/1628.csv?key=...", "POST", postArray);

of course with a valid api key...

Any ideas?

Comments

slateblue on April 3rd, 2009

I think you need to use PUT rather than POST?

Re: (405) Method Not Allowed

Rene on April 3rd, 2009

I always thought PUT and POST wh[ere the same. But I was wrong, thanks for the hint. At least there is a simple .NET example now ;-)

        byte[] postArray = Encoding.ASCII.GetBytes(value);
        WebClient wc = new WebClient();
        wc.Headers.Add("X-PachubeApiKey", "yourapikeyhere");
        wc.UploadData("http://www.pachube.com/api/999.csv", "PUT", postArray);

Re: (405) Method Not Allowed

uh@pachube on April 7th, 2009
Quote:

At least there is a simple .NET example now ;-)

nice! thanks for this. will update tutorials very soon with a link to this.

Re: (405) Method Not Allowed