{"id":8,"date":"2006-10-21T11:10:27","date_gmt":"2006-10-21T18:10:27","guid":{"rendered":"http:\/\/blog.mozilla.org\/axel\/2006\/10\/21\/thoughts-on-apis\/"},"modified":"2007-04-30T17:33:15","modified_gmt":"2007-05-01T00:33:15","slug":"thoughts-on-apis","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/axel\/2006\/10\/21\/thoughts-on-apis\/","title":{"rendered":"Thoughts on APIs"},"content":{"rendered":"<p>I guess it would be a good idea to share a few general baseline concepts I think I have learned while thinking about an RDF API.<\/p>\n<p>Query results should be queryable (does that word exist?). E4X does a great job here. <code>.foo<\/code> returns a <code>XMLList<\/code>, which you can query again with a <code>.bar<\/code>.<\/p>\n<p>The funny trick is to actually<\/p>\n<ul>\n<li>do that somewhat performant,<\/li>\n<li>get really usable individual results.<\/li>\n<\/ul>\n<p>The first item may be done by doing the actual queries as soon as you start using real results. The second item can be done by using <code>WANT_CONVERT<\/code> on <code>nsIXPCScriptable<\/code> cleverly.<\/p>\n<p>One challenge in doing a &#8220;nice&#8221; API is that<\/p>\n<pre>foo.bar.baz<\/pre>\n<p>is the same thing as<\/p>\n<pre>var tmp = foo.bar;\r\ntmp.baz<\/pre>\n<p>Doing late queries helps here, too.<\/p>\n<p>There is no good query API described in XPIDL. Design your interface to &#8220;just work&#8221; for C++ and to deliver the right data for the scriptable helper to provide the actual API to js clients.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I guess it would be a good idea to share a few general baseline concepts I think I have learned while thinking about an RDF API. Query results should be queryable (does that word exist?). E4X does a great job here. .foo returns a XMLList, which you can query again with a .bar. The funny [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts\/8"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/axel\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}