[wp-trac] [WordPress Trac] #56922: Template / Template parts revision / autosave REST API are broken

WordPress Trac noreply at wordpress.org
Tue Oct 10 07:53:56 UTC 2023


#56922: Template / Template parts revision / autosave REST API are broken
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.4
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:  rest-api
  testing changes-requested                      |
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 @antonvlasenko @hellofromTonya I find your feedback a little confusing.
 The URL pattern you have documented is incorrect. The correct url pattern
 is for templates and template parts is the following

 /wp/v2/templates/<id>

 A template <id> is a mixture of theme and id. For example

 wp/v2/templates/twentytwentyfour//home

 A template part, always contains the theme and the name. That is how
 template parts have worked since they were merged into core.

 The issue this ticket is trying to resolve is ids for post controller are
 normally id number based so.

 wp/v2/templates/123

 The revisions and autosave controllers guessed a pattern like this.

 wp/v2/templates/123/revisions.
 wp/v2/templates/123/autosaves.


 However, as template / template parts the url pattern needs to look like
 this.

 wp/v2/templates/twentytwentyfour//home/revisions.
 wp/v2/templates/twentytwentyfour//home/autosaves.

 We can't change the pattern of the url without break everything. This is
 how it work and this is why this ticket is needed.

 Also, the shape of the response you have given looks wrong, here is what
 is looks like for me.

 [[Image(https://core.trac.wordpress.org/raw-
 attachment/ticket/56922/Screenshot%202023-10-10%20at%2008.51.09.png)]]

 In summary, I don't think any of the things you documented are an issue,
 they are how it meant to work,

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


More information about the wp-trac mailing list