WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 5 months ago

#38343 new enhancement

Press This: Leverage REST API endpoints

Reported by: adamsilverstein Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Press This Keywords:
Focuses: javascript, rest-api Cc:

Description

If the REST API content endpoints were in core, how would we rebuild core features (like Press This) to use it? I am opening this ticket to track work on converting the Press This feature to using the REST API.

Press This is a compact JavaScript App available under tools that can be launched from the Dashboard, or from a browser's bookmarks/bookmark bar:

https://cl.ly/0u1F2Y1z2e0r/Press_This_2016-10-18_09-57-10.jpg

Press This communicates with WordPress via custom wp-ajax endpoints as well as by submitting form data directly to post.php via ajax mirroring what the wp post editor does. The goal here would be to switch all server interactions over to using the REST API:

  • Saving posts in submitPost, include handling to redirect the user (to the login page) similar to current code
  • Creating new categories in saveNewCategory

I've started work on this locally and will post a POC soon!

Attachments (2)

38343.diff (6.1 KB) - added by adamsilverstein 8 months ago.
38343.2.diff (9.1 KB) - added by adamsilverstein 6 months ago.

Download all attachments as: .zip

Change History (14)

This ticket was mentioned in Slack in #core-restapi by adamsilverstein. View the logs.


8 months ago

#2 @kraftbj
8 months ago

  • Component changed from General to Press This

This ticket was mentioned in Slack in #core-pressthis by kraft. View the logs.


8 months ago

This ticket was mentioned in Slack in #core by krogsgard. View the logs.


8 months ago

#5 @adamsilverstein
8 months ago

I have started work on a POC in a branch here: https://github.com/adamsilverstein/wordpress-develop/compare/master...adamsilverstein:ticket-38343, trying to match the functionality of the ajax callback.

I added some filters to both prepare and response to match the existing behavior and ensure backwards compatibility. I'm not sure where these filters belong, maybe in a new file?

Feedback and contributions welcome!

This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.


8 months ago

#7 @adamsilverstein
8 months ago

38343.diff covers submitPost post data and redirects. Working on categories/tags as part of save next as well as saveNewCategory.

This ticket was mentioned in Slack in #core-restapi by rachelbaker. View the logs.


8 months ago

This ticket was mentioned in Slack in #core by pento. View the logs.


8 months ago

#10 @adamsilverstein
6 months ago

38343.2.diff Switch category creation from admin-ajax press-this-add-category callback to using REST API. Should we remove the legacy ajax handlers?

Development continues in github, its easier to see whats changing by following the commits there: https://github.com/adamsilverstein/wordpress-develop/compare/master...adamsilverstein:ticket-38343

This ticket was mentioned in Slack in #core-restapi by adamsilverstein. View the logs.


5 months ago

#12 @afercia
5 months ago

  • Focuses rest-api added
Note: See TracTickets for help on using tickets.