On 02/06/2013 11:43 AM, Brad Jorsch wrote:
> On Wed, Feb 6, 2013 at 11:54 AM, Gabriel Wicke <gwi...@wikimedia.org> wrote:
>>
>> It should be possible to hide optimization details like local DB access
>> vs. an actual HTTP request behind the same interface. A URL-based query
>> interface can support local handlers for specific URL prefixes.
> 
> Or the interface can just look like a function call. Which seems a
> whole lot more straightforward than forcing people to encode a URL in
> Lua which is then passed to PHP and decoded to determine if it should
> be sent out as a remote request or looked up in the local DB.
I don't know much Lua, but a function call like this does not seem to be
*that* hard to use:

-- Would fetch JSON from
-- http://wikidata.org/api/query/?param1=foo&param2=bar
-- if no local handler is defined and the base URL is in a whitelist
jsonObject = JSONRequest("http://wikidata.org/api/query/";,
                         { param1="foo", param2="bar" } )

No manual encoding, and URL encoding can be completely skipped if the
prefix happens to match a registered local handler. An optional third
parameter can pass in a table to specify the request method and other
options.

Gabriel

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to