chmllr / notehub

A pastebin for markdown pages.
MIT License
273 stars 33 forks source link

Short URL and ID returned seem off #11

Closed ttscoff closed 10 years ago

ttscoff commented 10 years ago

I posted a new note via API and got back

The long url is correct. The ID seems to be missing slashes. The short url results in "OMG Server Exploded".

Did I do something wrong?

chmllr commented 10 years ago

Hi thanks a lot for the bug report!

No the ID is correct, there is an example of a valid ID in the API. I don't see any problems in using spaces in the ID as separator for name spaces.

The behavior of the short url's seems to be broken in general: I have refactored the core today. I'll look into this immediately.

ttscoff commented 10 years ago

When retrieving a note where the id has spaces, how should the id in the query be formatted? Percent encoded?

The ID returned for a note was 2014 1 19 this-is-a-test-26. This doesn't work, though:

curl 'http://www.notehub.org/api/note/?noteID=2014%201%2019%20this-is-a-test-26&version=1.1'

That gives me "Nothing Found" as an HTML page.

chmllr commented 10 years ago

The short-urls should work now for new notes created through API.

ttscoff commented 10 years ago

Did this also fix the last question I had above regarding ids in queries?

chmllr commented 10 years ago

Sorry, in the flood of messages yesterday I didn't notice this comment. I can confirm, that this doesn't work, however, what I see, is that it's not the problem of the ID because the entire request of Curl never arrives at the routing table. The same string works perfectly in browser. Can you confirm this?

I'll take a look into this today in the evening.

ttscoff commented 10 years ago

No, I get "Nothing found" at http://www.notehub.org/api/note/?noteID=2014%201%2019%20this-is-a-test-26&version=1.1 in Chrome as well.

chmllr commented 10 years ago

Ok, got it: you are using as url

http://www.notehub.org/api/note/

the last slash makes this a completely different route. It should be

http://www.notehub.org/api/note
chmllr commented 10 years ago

Also, I don't like spaces as separators anymore :-)

PS: I'll change it in the next API version with backwards compatibility, of course.