[wp-trac] [WordPress Trac] #49680: Consider also allowing POST requests for block ServerSideRender endpoint

WordPress Trac noreply at wordpress.org
Mon Apr 20 15:56:23 UTC 2020


#49680: Consider also allowing POST requests for block ServerSideRender endpoint
------------------------------------------+-----------------------
 Reporter:  ryankienstra                  |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  5.5
Component:  REST API                      |     Version:  5.0
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  rest-api
------------------------------------------+-----------------------

Comment (by TimothyBlynJacobs):

 Hi @ryankienstra,

 The idea of passing just the attributes as the JSON/POST body directly is
 interesting. But it isn't consistent with how the REST API generally
 handles parameters. `WP_REST_Request::get_param` will traverse all of the
 parameter locations looking for an attribute.

 Besides the inconsistencies, this would cause breakage if a block had a
 `post_id` attribute for example. Since it would fetch the value from the
 attributes, instead of the URL.

 Instead, we should just expand the accepted methods to include
 `WP_REST_Server::CREATABLE`. And then attributes can be passed in the body
 nested under `attributes`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49680#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list