[wp-trac] [WordPress Trac] #48822: Indicate partial success/error of a REST API request

WordPress Trac noreply at wordpress.org
Thu Nov 28 03:24:50 UTC 2019


#48822: Indicate partial success/error of a REST API request
-------------------------------+-----------------------------
 Reporter:  TimothyBlynJacobs  |      Owner:  (none)
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  REST API           |    Version:  4.7
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 Currently, when the REST API encounters an error, that error is typically
 immediately returned and any context about what processing has occurred is
 lost. A good example of this is creating a post.

 After the post is created an error can be returned after inserting terms,
 meta, and additional fields. The response does not provide a way to
 determine the ID of the post so updates could be made to the existing
 post, instead you must create a new post.

 As a first step, it'd be great if we could return a `Link` to the single
 item route. This is similar to the post-process link in the media endpoint
 except that we know there is a `WP_Error` instance, we don't have to
 always send the header. I think we'd do this by adding link support to
 `WP_Error`.

 A further step might be to add a way to allow returning a partial
 response. For instance, if I successfully inserted a post, but just
 inserting some meta values failed, it'd be ideal if I could receive back
 the prepared item as well as the errors that were encountered. This would
 probably require changing the output format. We could only return the
 different format if the client indicated that it could process it,
 possibly via the `Accept` header.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48822>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list