I’ll programm a simple syntax-editor in javascript. For the communication with osm, I use https://github.com/osmlab/osm-auth.
If I want to create a new changeset, I get everytime a “401 - Unauthorized”.
auth.xhr({
method: 'GET',
path: '/api/0.6/user/details'
}, done);
succeeded
auth.xhr({
method: 'GET',
path: '/api/0.6/permissions'
}, function(err, details) {
console.log(err);
console.log(details);
});
succeeded with following permissions:
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="OpenStreetMap Server">
<permissions>
<permission name="allow_read_prefs"/>
<permission name="allow_write_api"/>
<permission name="allow_write_notes"/>
</permissions>
</osm>
But if I create a new Changeset with:
auth.xhr({
method: 'PUT',
path: '/api/0.6/changeset/create',
content:
'<osm>'+
'<changeset>'+
'<tag k="created_by" v="xxxxxxxxxxxxxxxx"/>'+
'<tag k="comment" v="Testing"/>'+
'</changeset>'+
'</osm>'
}, function(err, details) {
console.log(err);
console.log(details);
});
I get
I test from a localhost-environment.