Time |
S |
Nick |
Message |
02:07 |
|
pdurbin |
today I learned about this as an alternative to AtomPub: Collection+JSON - Hypermedia Type : Media Types - http://amundsen.com/media-types/collection/ |
02:07 |
|
pdurbin |
via http://rest.hackyhack.net/2013-08-09.html#51/h51 |
02:10 |
|
pdurbin |
hmm, and now that I'm catching up on that log, I hadn't heard of this either: The Hypertext Application Language - http://stateless.co/hal_specification.html (HAL) |
02:28 |
|
semiosis |
+1 |
02:36 |
|
semiosis |
i saw this talk (or a variation of it) at the SunshinePHP conf earlier this year: http://www.slideshare.net/LukeStokes/pox-to-hateoas-13077649 |
02:37 |
|
semiosis |
it was my first introduction to these things (HAL, Collection+JSON, etc) |
02:38 |
|
semiosis |
pdurbin: |
03:18 |
|
pdurbin |
semiosis: ah. ok |
03:20 |
|
pdurbin |
how come PUT is for both create and update? :) |
03:21 |
|
semiosis |
good question |
03:22 |
|
semiosis |
great explanation: http://www.packetizer.com/ws/rest.html |
03:22 |
|
semiosis |
see the section called Safety & Idempotence |
03:22 |
|
semiosis |
s/&/and/ |
03:23 |
|
semiosis |
one simplistic way of looking at it is that POST is for creating a new resource when you don't know the URL where it will live, PUT for when you do know the URL |
03:25 |
|
pdurbin |
"The key difference is that POST is used when the server is in control of storing information, not the client." |
03:25 |
|
pdurbin |
hadn't seen that before |
03:32 |
|
semiosis |
on the topic of rest design, i also found this helpful: http://blog.apigee.com/detail/slides_for_restful_api_design_second_edition_webinar/ |
03:32 |
|
semiosis |
looks like the author updated it again in jan, a 3rd edition |
12:51 |
|
|
agoddard joined #sourcefu |
15:37 |
|
pdurbin |
agoddard: I think I do like http://ruby-doc.org/stdlib-1.8.7/libdoc/rexml/rdoc/index.html a log better than http://docs.python.org/2/library/xml.etree.elementtree.html |
15:51 |
|
pdurbin |
yeah, I don't like the output from xml.etree.ElementTree.dump(elem) |
15:53 |
|
pdurbin |
with rexml I can just `puts foo` and it shows the original XML, not some weird version with ns0 and ns1 in it |
15:53 |
|
pdurbin |
plus I can use backticks... ahhhh ... so perl-y :) |
15:58 |
|
pdurbin |
or shell-y, I suppose :) |
16:04 |
|
pdurbin |
I guess switching from |
16:04 |
|
pdurbin |
Popen("myscript", stdout=PIPE).communicate()[0] |
16:04 |
|
pdurbin |
to |
16:04 |
|
pdurbin |
os.popen("myscript").read() |
16:04 |
|
pdurbin |
helps a lot. but still... love me some backticks |
16:57 |
|
pdurbin |
ah, ha, I can get rid of ns0 by registring a blank namespace. i.e. etree.register_namespace('', 'http://some.namespace') at http://stackoverflow.com/questions/8113296/supressing-namespace-prefixes-in-elementtree-1-2 |
17:11 |
|
pdurbin |
less brittle XML parsing in Python, Ruby proof of concept · be9cdb9 · IQSS/dvn - https://github.com/IQSS/dvn/commit/be9cdb9 |
17:11 |
|
pdurbin |
yeah, I like the Ruby version much better ^^ |
17:12 |
|
pdurbin |
this just works: deposit_target = XPath.first(sd, "//collection/@href") |
17:12 |
|
pdurbin |
this is nuts: deposit_target = service_document.find(".//{http://www.w3.org/2007/app}workspace/{http://www.w3.org/2007/app}collection").attrib["href"] |
19:04 |
|
pdurbin |
convert from Python to Ruby for easier XML parsing · 37897a2 · IQSS/dvn - https://github.com/IQSS/dvn/commit/37897a2 |
19:04 |
|
pdurbin |
agoddard: ^^ :) |