public class OSmController : ApiController
{
[HttpPost]
public async Task CreateNode()
{
string url = “http://*api/0.7/node/create”;
string apiKey = “Read-Only”;
// Construct the XML payload
string xmlData = $@"
<osm>
<node lat=""33.642782"" lon=""73.077733"" version=""1"" changeset=""1"">
<tag k=""key1"" v=""value1""/>
<tag k=""key2"" v=""value2""/>
</node>
</osm>";
using (HttpClient client = new HttpClient())
{
// Create the HTTP content with XML payload
HttpContent content = new StringContent(xmlData, Encoding.UTF8, "application/xml");
// Make the POST request
HttpResponseMessage response = await client.PostAsync(url, content);
// Check if the request was successful
if (response.IsSuccessStatusCode)
{
return Ok("Node created successfully!");
}
else
{
return BadRequest("Failed to create node. Status code: " + response.StatusCode);
}
}
}
}
I’m using these lines of code to create a node on my local osm server but i’m facing an error “Internal server error 500”
can any one help me please!!!