NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi, I'm creating a client for OSM api. I'm failing to create a changeset. (I'm using developers' url). I'm sending followings in header. oauth_token,oauth_consumer_key,oauth_signature_method,oauth_version,oauth_nonce,oauth_timestamp And message body as follows:

<osm>
<changeset><tag k="A" v="Aaa"/><tag k="B" v="Bbb"/><tag k="c" v="Ccc"/></changeset>
<changeset><tag k="B" v="Bbl"/></changeset>
<changeset><tag k="A" v="Aab"/><tag k="F" v="Afff"/><tag k="B" v="bbb"/></changeset>
</osm>

After sending data to server using PUT, I'm receiving http 500 response (Application error).

Could someone help to solve this issue please?

Thanks!

asked 13 Nov '12, 16:25

buddhima's gravatar image

buddhima
1166711
accept rate: 0%

edited 14 Nov '12, 14:13

Harry%20Wood's gravatar image

Harry Wood
9.5k2588128

1

Silly question : which URI are you using ? /api/0.6/changeset/create

Did you try first with only one <changeset> element ?

(14 Nov '12, 10:01) Pieren
1

Hi, url is http://api06.dev.openstreetmap.org/api/0.6/changeset/create Yes, I've tried with only one element too. But the result is same

(14 Nov '12, 10:05) buddhima

I don't know exactly the reason for the 500 error code, but you are at least missing the xml tag. Here are the header and body of a PUT request to /api/0.6/changeset/create from a recent JOSM version:

header:

PUT /api/0.6/changeset/create HTTP/1.1
User-Agent: JOSM/1.5 (5587 de)
Connection: close
Authorization: OAuth oauth_token="blah", oauth_consumer_key="blah", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1353272088", oauth_nonce="blah", oauth_signature="blah"
Content-type: text/xml
Host: api.openstreetmap.org
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Length: 42

body:

<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='JOSM'>
  <changeset  id='0' open='false'>
    <tag k='comment' v='my changeset comment' />
    <tag k='created_by' v='JOSM/1.5 (5581 en)' />
  </changeset>
</osm>

Also make sure to always include the comment and created_by tag in your changesets.

permanent link

answered 15 Nov '12, 06:59

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 18 Nov '12, 20:58

Hi, In API spec. it is not mentioned to add xml tag. I failed even it is added. is it necessary to add version,generator attributes to osm tag? and id, open attributes in changeset tag?

I also would appriciate, if you can give me an example of PUT with headers too. (eg: Content-Type,etc.) Thanks!

(18 Nov '12, 19:06) buddhima

I've added a header. You can use a program like wireshark or tcpdump yourself to read network packets of JOSM or other programs.

I'm not familiar with the API details so I can't say anything about which XML attributes are required and which not. Just try it if you can't find anything in the API documentation about this.

(18 Nov '12, 21:00) scai ♦

Hi All, Thanks for the help, specially scai. Message should follow following format in body.

<?xml version="1.0" encoding="UTF-8"?> 
<osm version="0.6" generator="MyOpenstreetmapApp"> 
<changeset>
    <tag k='comment' v='my changeset comment' />
    <tag k='created_by' v='JOSM/1.5 (5581 en)' />   
</changeset> 
</osm>

The above message format worked finally !

permanent link

answered 14 Dec '12, 15:50

buddhima's gravatar image

buddhima
1166711
accept rate: 0%

edited 14 Dec '12, 15:51

The detail is on the wiki page. You need to submit the page with an HTTP PUT.

permanent link

answered 14 Nov '12, 20:28

ChrisH's gravatar image

ChrisH
4.1k134262
accept rate: 15%

Hi, I was following that wiki page.But fails. can someone give me a full details of a successful http PUT request to OSM Thanks

(15 Nov '12, 03:40) buddhima

You may have an authentication problem. Check this page about OAuth in OSM : http://wiki.openstreetmap.org/wiki/OAuth

(15 Nov '12, 12:51) Pieren

Hi, It's not a problem with authentication, since I'm getting a token and a secret after Access Token step. Thanks

(16 Nov '12, 14:11) buddhima

i have latitude and longitude of a location. i want to upload xml file about this location to add POI.where should i use lat and long? In changset?

(20 Nov '15, 05:42) Er Pawan Verma

@Er Pawan Verma: to the node object. See the documentation for the API - e.g. about nodes. Please keep in mind that you should not create objects automatically.

(20 Nov '15, 05:58) aseerel4c26 ♦

How can i put changeset? when i dont know.

(20 Nov '15, 06:02) Er Pawan Verma

Please don't hijack other people's question. Ask a new question instead (which you already did here).

(20 Nov '15, 07:49) scai ♦
showing 5 of 7 show 2 more comments

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×290
×127
×22
×5
×5

question asked: 13 Nov '12, 16:25

question was seen: 6,458 times

last updated: 20 Nov '15, 07:49

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum