Hello guys,

I quite fighting with OSM API v0.6 and upload GPX track task. I'm developing application for Android and trying to use this method. Firstly I though it should be a problem of login, so I changed login mechanism to OAuth. Anyway same result now.

After selecting track and settings all parameters (description ('test'), tags ('test'), visibility ('public')), uploading always return 400 Bad Request, no content, no error message

---------- REQUEST -----------
org.apache.http.client.methods.HttpPost@427e06f8, url: http://api.openstreetmap.org/api/0.6/gpx/create
headers: Content-Type: multipart/form-data
headers: Accept-Charset: ISO-8859-2, utf-8
headers: Accept-Encoding: gzip,deflate
headers: User-Agent: Locus/2.5.6 (Linux; U; Android; en-us)
HttpPost entity:com.google.android.common.http.MultipartEntity@427e0d98

---------- RESPONSE -----------
statusLine:HTTP/1.1 400 Bad Request
headers:Date, Thu, 16 Aug 2012 13:34:33 GMT
headers:Server, Apache/2.2.22 (Ubuntu)
headers:X-Powered-By, Phusion Passenger (mod_rails/mod_rack) 3.0.14
headers:Vary, Accept-Language,Accept-Encoding
headers:Content-Language, en
headers:Cache-Control, no-cache
headers:X-Request-Id, 0bbf0e2fd3e78e4f855718f7e53dbef5
headers:X-Runtime, 0.366059
headers:X-UA-Compatible, IE=Edge,chrome=1
headers:Status, 400
headers:Content-Encoding, gzip
headers:Content-Length, 21
headers:Connection, close
headers:Content-Type, text/html; charset=utf-8

exactly same track uploaded by web site works. Have someone any idea or any method how to test what is problem on OSM server? Thank you!

asked 16 Aug '12, 14:57

menion's gravatar image

menion
88114
accept rate: 0%

1

You should not use api.osm.org for testing and development. There is an instance of the api on a different database for that at api06.dev.openstreetmap.org

(16 Aug '12, 15:12) Gnonthgol ♦

I know. I was testing upload on api06.dev ... but it also not worked. So I tried direct upload by web site also on this api06.dev... where it also not work!! compare to normal api.open ... where upload of same file works without problem (upload deleted, don't worry)

anyway same result on both sites

(16 Aug '12, 15:29) menion

after another fight-time, problem fixed - so just if anyone have same problem:

seems like OSM server cannot correctly handle com.google.android.common.http.MultipartEntity object. Solution is to use Apache HttpComponents library and it's own implementation of MultipartEntity object. With this is no problem with posting GPX tracks

permanent link

answered 16 Aug '12, 20:41

menion's gravatar image

menion
88114
accept rate: 0%

Hey, i am facing a similar problem with C# could you please explain your solution in detail.

Regards

(24 Oct '14, 14:03) Osm_Enthu
1

Hello Enthu,

I'm worried, I can't help here more. Exact reason, why one solution work and second don't is not known to me. My solution was simply - I've changed library I used for different kind. So I can only suggest this to you. If you use any library for sending MutliPart objects over HTTP, then try different library.

(24 Oct '14, 14:25) menion

Thats for all of those who came stumbling here

http://www.briangrinstead.com/blog/multipart-form-post-in-c

permanent link

answered 27 Oct '14, 13:56

Osm_Enthu's gravatar image

Osm_Enthu
56337
accept rate: 0%

Your answer
toggle preview

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:

×237
×222
×95
×6

question asked: 16 Aug '12, 14:57

question was seen: 4,826 times

last updated: 27 Oct '14, 13:56

powered by OSQA