SpaceApi-archive / SpaceApi

Android app and widget showing hackerspace status
18 stars 10 forks source link

discovery using HEAD #47

Open elf-pavlik opened 11 years ago

elf-pavlik commented 11 years ago

similar as in: http://www.markus-lanthaler.com/hydra/spec/latest/core/#discovering-a-hydra-powered-web-api

HEAD / HTTP/1.1 Host: www.example.com

HTTP/1.1 200 OK ... Content-Type: application/ld+json Link: http://api.example.com/doc/; rel="http://purl.org/hydra/core#apiDocumentation"

brimstone commented 11 years ago

That's neat. Would you say HEAD https://256.makerslocal.org and expect to find a header referencing https://256.makerslocal.org/status.json?

matt

elf-pavlik commented 11 years ago
$ curl -I https://256.makerslocal.org

HTTP/1.1 200 OK
Date: Sat, 24 Aug 2013 09:13:44 GMT
Server: Apache/2.2.16
X-Powered-By: PHP/5.3.3-7+squeeze16
X-Pingback: https://256.makerslocal.org/blog/xmlrpc.php
Cache-Control: max-age=300
Expires: Sat, 24 Aug 2013 09:18:44 GMT
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8

it would just need additional:

Link: https://256.makerslocal.org/status.json; rel="spaceapi"

which reminds me about creating a ticket to set rel to URI or just register spaceapi with http://www.iana.org/assignments/link-relations/link-relations.xhtml

slopjong commented 11 years ago

I'm more in favour of GET instead of HEAD. The reason is that with GET you could directly return the spaceapi implemention. This saves one addition request. Think of clients firing 400 requests to assemble the directory. With 100-200 directory entries 400 requests would be quite a realistic number because of server-side redirections and/or link/rel crawling & parsing. 400 requests is a lot and what if we have 500 spaces in 2 years?

That's not scaling.

slopjong commented 11 years ago

Additional there's a big potential to break things more easily. Nowadays it's just redirections or changin URLs which break. Additional link relations and complexity is just increasing the vector of breakage.

Currently there's no problem which the discovery tag or the HEAD/GET request would solve. They just increase the complexity whilst the manpower for developing/bugfixing is still very low.