WordPress.org

WordPRess GSoC Trac

#290 closed defect (fixed)

All fields must be specified to add extra fields

Reported by: rmccue Owned by:
Milestone: 2013 Midterm (Beta) Priority: normal
Component: JSON REST API Keywords:
Cc:

Description

If you want to specify additional fields from getPost, you need to know what the default fields are rather than just adding extra fields.

There are two solutions to this:

  1. We allow users to specify "default" as a special field that includes all the default fields
  2. We always include all default fields and the fields parameter becomes only additional fields

The second option seems like a better long-term solution, since API clients need to be able to rely on fields being there as per the specification. It also removes complexity from the system.

I'll likely revise this later, but implementing the first option for now as a stopgap solution. The XML-RPC API already uses this style, so I'll stick with it for now.

Change History (2)

comment:1 rmccue10 months ago

In 2015:

Allow passing in "default" for fields

This means that instead of having to know what the internal default fields are,
you can just add fields to them (e.g. fields[]=default&fields[]=post-extended)

See #290

comment:2 rmccue10 months ago

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

Marking as fixed, as per above.

Note: See TracTickets for help on using tickets.