[OSM-dev] api update question
Rob
rob at coolbegin.com
Sun Jan 20 23:09:44 GMT 2008
i'm trying to update a node from my project (C#)
when i do the web request, the GetResponse returns with "The remote server
returned an error: (417) Expectation Failed."
do i need to change the content type ? or do i have to include
action='modify' in the node ?
string strXml = "<?xml version='1.0' encoding='UTF-8'?><osm
version='0.5' generator='OSMTAGEDITOR'><node id='30226967' lat='50.8489498'
lon='5.6878935' user='rubke' timestamp='2008-01-20T14:56:52Z'><tag
k='amenity' v='place_of_worship' /><tag k='denomination'
v='christian/catholic' /><tag k='name' v='St-Servaasbasiliek' /><tag
k='religion' v='christian' /></node></osm>";
HttpWebRequest HttpWRequest =
(HttpWebRequest)WebRequest.Create("
http://api.openstreetmap.org/api/0.5/node/30226967");
HttpWRequest.PreAuthenticate = true;
HttpWRequest.Credentials = new NetworkCredential("xxxx",
"xxxx");
HttpWRequest.Method = "PUT";
HttpWRequest.ContentLength = strXml.Length;
HttpWRequest.ContentType = "text/plain";
using (StreamWriter writer = new StreamWriter(
HttpWRequest.GetRequestStream()))
{
writer.WriteLine(strXml);
}
WebResponse response = HttpWRequest.GetResponse();
using (StreamReader reader = new StreamReader(
response.GetResponseStream()))
{
while (reader.Peek() != -1)
{
Console.WriteLine(reader.ReadLine());
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080121/3e572d66/attachment.html>
More information about the dev
mailing list