[wp-trac] [WordPress Trac] #14618: Proposal: Standardize WP Responses to JS Requests as JSON
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 26 02:17:32 UTC 2010
#14618: Proposal: Standardize WP Responses to JS Requests as JSON
-------------------------+--------------------------------------------------
Reporter: filosofo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: JavaScript | Version: 3.0
Severity: normal | Keywords: needs-patch
-------------------------+--------------------------------------------------
Comment(by filosofo):
Replying to [comment:20 josephscott]:
> You asked for an example, I provided one. JSON-RPC will suffer from the
same problem XML-RPC does in this area.
Joseph, you said that the lack of binary support was "the single biggest
weakness in XML-RPC from my point of view." For it to be a weakness
relevant to ''this'' proposal (as opposed to XML/JSON RPC in the
abstract), it would need to have some bearing on likely use.
> > Which can be solved the same way. That seems to be how many popular
web APIs handle such things; take a look for example at the Google Maps
and MailChimp API versioning.
>
> I scanned through the docs for both of these, I didn't see JSON-RPC
listed as an option for either one. Quite the opposite, they use more
standard direct HTTP APIs, as I suggested in my first comment.
Sorry not to be clear. I meant using the ''endpoint'' to indicate API
version rather than each ''method'', because you said "I was thinking of
per method versions."
> Perhaps I stopped following the development of JSON-RPC too soon then.
I hadn't seen much uptake in JSON-RPC, though I might not be looking in
the right places.
I meant JSON in general.
> As I suggested in my first comment on this ticket, my suggest is to use
a simple direct HTTP based API. Not an RPC based API.
>
> The Twitter and Facebook Graph APIs are popular examples of what I'm
suggesting.
I'm not sure what you're arguing against. Are you arguing against using
JSON as a format for request and response? Then my response is:
* JSON is used in response by both examples you cite, Twitter and
Facebook.
* It seems to be growing in popularity. I admit I can't provide numbers
to demonstrate that conclusively.
* It's lightweight.
* It works well with a lot of languages; JS most obviously and
relevantly.
Are you arguing against having any protocol for remote procedure calls?
Then my response is:
* Standardization is good for the reasons I've mentioned several times so
far (and without apparent disagreement).
* Putting the RPC methods in an easy-to-parse request object avoids
potential namespace collisions and the ambiguities of parsing a request
URL.
* Having a third-party protocol is generally better than coming up with
your own, both in terms of work for yourself and others, in maintenance
and learning the syntax.
* We already have a ton of WP methods defined for XML RPC, which we can
re-use for JSON RPC.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14618#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list