Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#38373 closed feature request (fixed)

WP REST API Stage Two: Content API

Reported by: rachelbaker's profile rachelbaker Owned by: rachelbaker's profile rachelbaker
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: REST API Keywords: needs-patch
Focuses: Cc:

Description

This will be used as the master tracking ticket for Stage Two of the WP REST API feature plugin, which has been proposed for merge in the 4.7 release.

Stage Two Content API: For WordPress 4.7 the API team proposes to merge API endpoints for WordPress content types. These endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, allowing new and innovative apps for interacting with your site. These endpoints support all of the following:

Content:

  • Posts: Read and write access to all post data, for all types of post-based data, including pages and media.
  • Comments: Read and write access to all comment data. This includes pingbacks and trackbacks.
  • Terms: Read and write access to all term data.
  • Users: Read and write access to all user data. This includes public access to some data for post authors.
  • Meta: Read and write access to metadata for posts, comments, terms, and users, on an opt-in basis from plugins.

Management:

  • Settings: Read and write access to settings, on an opt-in basis from plugins and core. This enables API management of key site content values that are technically stored in options, such as site title and byline.

This merge proposal represents a complete and functional Content API, providing the necessary endpoints for mobile apps and frontends, and lays the groundwork for future releases focused on providing a Management API interface for full site administration.

Content API endpoints support both public and authenticated access. Authenticated access allows both read and write access to anything your user has access to, including post meta and settings. Public access is available for any already-public data, such as posts, terms, and limited user data for published post authors. To avoid potential privacy issues we’ve taken pains to ensure that everything we’re exposing is already public, and the API uses WordPress’ capability system extensively to ensure that all data is properly secured.

Just like the rest of WordPress, the Content API is fully extensible, supporting custom post meta, as well as allowing more complex data to be added via register_rest_field. The API is built around standard parts of WordPress, including the capability system and filters, so extending the API in plugins should feel as familiar to developers as extending any other part of WordPress.

This Content API is targeted at a few primary use cases, including enhancing themes with interactivity, creating powerful plugin interfaces, building mobile and desktop applications, and providing alternative authoring experiences. We’ve been working on first-party examples of these, including a mobile app using React Native and a liveblogging web app, as well as getting feedback from others, including WIRED, the New York Times, and The Times of London. Based on experience building on the API, we’ve polished the endpoints and expanded to support settings endpoints, which are included as the first part of the Management API.

GitHub Repo: https://github.com/WP-API/WP-API
Merge Proposal: https://make.wordpress.org/core/2015/09/21/wp-rest-api-merge-proposal/
Merge Proposal Discussion: https://make.wordpress.org/core/2016/10/13/merge-proposal-discussion-rest-api-content-endpoints/
Success Metrics: https://make.wordpress.org/core/2016/10/19/wordpress-rest-api-success-metrics/

Attachments (2)

38373.diff (783.4 KB) - added by rachelbaker 8 years ago.
Initial pass at generating a patch from github.com/WP-API/WP-API
38373.2.diff (780.5 KB) - added by rachelbaker 8 years ago.

Download all attachments as: .zip

Change History (10)

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


8 years ago

@rachelbaker
8 years ago

Initial pass at generating a patch from github.com/WP-API/WP-API

#2 @rachelbaker
8 years ago

Props list:

rmccue
rachelbaker
danielbachhuber
joehoyle
adamsilverstein
afurculita
ahmadawais
airesvsg
alisspers
antisilent
apokalyptik
artoliukkonen
attitude
boonebgorges
bradyvercher
brianhogg
caseypatrickdriscoll
chopinbach
chredd
christianesperar
chrisvanpatten
claudiolabarbera
claudiosmweb
cmmarslender
codebykat
coderkevin
codfish
codonnell822
daggerhart
danielpunkass
davidbhayes
delphinus
desrosj
dimadin
dotancohen
DrewAPicture
Dudo1985
duncanjbrown
eherman24
eivhyl
eliorivero
elyobo
en-alis
ericandrewlewis
ericpedia
evansobkowicz
fjarrett
frozzare
georgestephanis
greatislander
guavaworks
hideokamoto
hkdobrev
hubdotcom
hurtige
iandunn
ircrash
ironpaperweight
iseulde
Japh
jaredcobb
JDGrimes
jdolan
jdoubleu
jeremyfelt
jimt
jjeaton
jmusal
jnylen0
johanmynhardt
johnbillion
jonathanbardo
jorbin
joshkadis
JPry
jshreve
jtsternberg
JustinSainton
kacperszurek
kadamwhite
kalenjohnson
kellbot
kjbenk
kokarn
krogsgard
kuchenundkakao
kuldipem
kwight
lgedeon
lukepettway
mantismamita
markoheijnen
matrixik
mattheu
mauteri
maxcutler
mayukojpn
michael-arestad
miyauchi
mjbanks
modemlooper
mrbobbybryant
NateWr
nathanrice
netweb
NikV
nullvariable
oskosk
oso96_2000
oxymoron
pcfreak30
pento
peterwilsoncc
Pezzab
phh
pippinsplugins
pjgalbraith
pkevan
pollyplummer
pushred
quasel
QWp6t
schlessera
schrapel
Shelob9
shprink
simonlampen
Soean
solal
tapsboy
tfrommen
tharsheblows
thenbrent
tierra
tlovett1
tnegri
tobych
Toddses
toro_unit
traversal
vanillalounge
vishalkakadiya
wanecek
web2style
webbgaraget
websupporter
westonruter
whyisjake
wonderboymusic
wpsmith
xknown
zyphonic

Last edited 8 years ago by rachelbaker (previous) (diff)

@rachelbaker
8 years ago

#3 @rachelbaker
8 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 38832:

REST API: Introduce the Content API endpoints.

REST API endpoints for your WordPress content. These endpoints provide machine-readable external access to your WordPress site with a clear, standards-driven interface, allowing new and innovative apps for interacting with your site. These endpoints support all of the following:

  • Posts: Read and write access to all post data, for all types of post-based data, including pages and media.
  • Comments: Read and write access to all comment data. This includes pingbacks and trackbacks.
  • Terms: Read and write access to all term data.
  • Users: Read and write access to all user data. This includes public access to some data for post authors.
  • Meta: Read and write access to metadata for posts, comments, terms, and users, on an opt-in basis from plugins.
  • Settings: Read and write access to settings, on an opt-in basis from plugins and core. This enables API management of key site content values that are technically stored in options, such as site title and byline.

Love your REST API, WordPress! The infrastructure says, "Let's do lunch!" but the content API endpoints say, "You're paying!"

Props rmccue, rachelbaker, danielbachhuber, joehoyle, adamsilverstein, afurculita, ahmadawais, airesvsg, alisspers, antisilent, apokalyptik, artoliukkonen, attitude, boonebgorges, bradyvercher, brianhogg, caseypatrickdriscoll, chopinbach, chredd, christianesperar, chrisvanpatten, claudiolabarbera, claudiosmweb, cmmarslender, codebykat, coderkevin, codfish, codonnell822, daggerhart, danielpunkass, davidbhayes, delphinus, desrosj, dimadin, dotancohen, DrewAPicture, Dudo1985, duncanjbrown, eherman24, eivhyl, eliorivero, elyobo, en-alis, ericandrewlewis, ericpedia, evansobkowicz, fjarrett, frozzare, georgestephanis, greatislander, guavaworks, hideokamoto, hkdobrev, hubdotcom, hurtige, iandunn, ircrash, ironpaperweight, iseulde, Japh, jaredcobb, JDGrimes, jdolan, jdoubleu, jeremyfelt, jimt, jjeaton, jmusal, jnylen0, johanmynhardt, johnbillion, jonathanbardo, jorbin, joshkadis, JPry, jshreve, jtsternberg, JustinSainton, kacperszurek, kadamwhite, kalenjohnson, kellbot, kjbenk, kokarn, krogsgard, kuchenundkakao, kuldipem, kwight, lgedeon, lukepettway, mantismamita, markoheijnen, matrixik, mattheu, mauteri, maxcutler, mayukojpn, michael-arestad, miyauchi, mjbanks, modemlooper, mrbobbybryant, NateWr, nathanrice, netweb, NikV, nullvariable, oskosk, oso96_2000, oxymoron, pcfreak30, pento, peterwilsoncc, Pezzab, phh, pippinsplugins, pjgalbraith, pkevan, pollyplummer, pushred, quasel, QWp6t, schlessera, schrapel, Shelob9, shprink, simonlampen, Soean, solal, tapsboy, tfrommen, tharsheblows, thenbrent, tierra, tlovett1, tnegri, tobych, Toddses, toro_unit, traversal, vanillalounge, vishalkakadiya, wanecek, web2style, webbgaraget, websupporter, westonruter, whyisjake, wonderboymusic, wpsmith, xknown, zyphonic.
Fixes #38373.

#4 @rachelbaker
8 years ago

In 38834:

REST API: Fix test failures.

  • Fix leak in setup_notify_comment() test help by removing the comment_flood_filter.
  • Correct uses of $term_taxonomy_id -> $term_id in Category and Tags routing.
  • Temporarily remove the metadata tests for canola.jpg as that file does not have an exifdata. Will need to update the test.

Props jorbin, rmccue, nacin
See #38373.

#5 @rachelbaker
8 years ago

In 38835:

REST API: Fix comment option leak causing another test failure.

Set the 'comment_whitelist' option back to the default when tearing down wpAllowComment tests.

See #38373.

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


8 years ago

#7 @swissspidy
7 years ago

#35582 was marked as a duplicate.

#8 @johnbillion
7 years ago

In 40545:

REST API: Remove a useless unit test.

See #35907, #38373

Note: See TracTickets for help on using tickets.