Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#39452 closed enhancement (wontfix)

add the rest API root url to the admin header

Reported by: pbearne's profile pbearne Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: REST API Keywords: has-patch
Focuses: Cc:

Description

we add by default the the ajaxurl to the js vars we should also add the rest root url

resturl = '<?php echo rest_url( '/' ); ?>',

Attachments (1)

admin-header.php.patch (756 bytes) - added by pbearne 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @pbearne
8 years ago

I have added in this patch the url to main admin header the ajaxurl is set in few other location but I am not sure which other we should change as well

#2 @pbearne
8 years ago

  • Keywords has-patch dev-feedback added

#3 @dd32
8 years ago

Passing rest_url( '/' ) into the header isn't useful, as it lacks the nonce, but ignoring that - I guess the main question is should we be pushing most clients to utilising the wp-api script, or rolling their own XHR handlers?

One of the main reasons I've avoided using wp-api personally is that I haven't found any documentation of how I'm supposed to utilise it, I'm not sure others would've faired much better.

#4 @pbearne
8 years ago

Yes not have the rest nonoce it a valid point and we can add that to this patch as that will help and use of the API in the admin.

I believe that the api is lighter weight than admin ajax

Yes I agree about the documentation may this ticket will kick that off abit more

#5 @dd32
8 years ago

I believe that the api is lighter weight than admin ajax

My point was about using wp-api which exposes a wp.api javascript handler with models and collections of api endpoints, vs rolling their own XHR requests to the rest api endpoints (as previously done with admin-ajax.php)

#6 @rmccue
8 years ago

  • Keywords close added

I'd rather we push people towards the first-class Backbone library. Documented as part of the REST API reference. We probably want to expand that out further, I'd imagine.

#7 @rmccue
8 years ago

  • Keywords dev-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

No traction, closing out per my above note.

Note: See TracTickets for help on using tickets.