Android to OSM apiv0.6 Upload


I am developing an android app using phonegap apis. I would like the app to to upload map data to osm using the osm apiv0.6. iam using the code below from localhost to create a changeset:

        function createChangeset(){

        var xmlData = '<osm><changeset><tag k="created_by" v="JOSM 1.61"/><tag k="comment" v="Just adding some streetnames"/>    </changeset></osm>';

        var url1 = "";
	var r = $.ajax({
	username: "",
        password: "lettersforme",
        url: url1,
	data: xmlData,
	"error":function(xhr, textStatus, errorThrown)
	if (xhr.status === 0) {
                alert('Not connect.\n Verify Network.');
            } else if (xhr.status == 404) {
                alert('Requested page not found. [404]');
            } else if (xhr.status == 500) {
                alert('Internal Server Error [500].');
            } else if (textStatus === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (textStatus === 'timeout') {
                alert('Time out error.');
            } else if (textStatus === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Uncaught Error.\n' + xhr.responseText);


I get 2 errors

  1. OPTIONS 404 (Not Found)
  2. XMLHttpRequest cannot load Origin null is not allowed by Access-Control-Allow-Origin.

It also shows alert from code above with “Not connect verify network”. I have read about Same Origin Policy but i have not seen any osm v0.6 api calls that return jsonp.

Please show how to make authentication,upload, element creation calls to osm api v0.6 using jquery?

removing the dataType: “xml” line gets rid of the errors but i still dont get expected response from server of changeset id. can anyone help?

Hi David, pay attention: in your code you give your username and password…

I think someone should hide his user & pass before he gets hacked

This topic is relatively old, and is posted on several places like mail-list and Help. So if nobody hacked him so far I think he have nothing to worry, unless he haven’t changed the password. Or this is fake password, or demo account, in which case it doesn’t matter.

But back to the original question, I can’t help you with that except maybe point you to wiki page.