[wp-trac] [WordPress Trac] #14618: Proposal: Standardize WP Responses to JS Requests as JSON

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 25 23:21:42 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:16 josephscott]:
 > Replying to [comment:14 filosofo]:
 > > What is the current use case in which you're posting binary data via
 XHR?
 >
 > Uploading images (or any other media file) is the obvious target.

 True XHR uploads are very fringe.  They're not going to be supported
 across enough browsers any time in the near future and aren't being used
 in current WP.

 I'm not saying ''everything'' asynchronous should use also JSON RPC; just
 most of the stuff that's communicating information, executing commands,
 etc.---the vast majority if not everything currently being done in WP.

 I'm trying to figure out why you think support for something we're not
 doing currently and likely won't be able to do for years is particularly
 relevant.  But sure, we could allow exceptions for binary data Ajax.

 > Also, any generalized API like the one proposed will not be limited to
 just XHR use.

 True.  But whatever is going to make use of the API in this future state
 will have more choices under my proposal; it won't be harmed by it.

 > True, I should have been more specific, I was thinking of per method
 versions.

 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 don't see that any of these reasons require an RPC approach.

 You're right that they don't ''require'' this ''specific'' approach.
 However, they do require ''some'' sort of standardization as opposed to
 the current eclecticism.  JSON RPC has the advantage of being an already-
 existing standard, widening support and familiarity throughout the web dev
 world, being easy to use in JS, among other things.

 However, I'm reasonably certain another communication standard could work
 almost as well.  My point is pushing to a decent standard, not finding the
 absolutely perfect one.  Do you have an alternative in mind?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14618#comment:17>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list