Make WordPress Core

Opened 5 years ago

#48257 new defect (bug)

REST API: post-process endpoint cannot be discovered from media creation endpoint

Reported by: kadamwhite's profile kadamwhite Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.3
Component: REST API Keywords: needs-patch
Focuses: rest-api Cc:


Split out from #47987:

In #47987 we introduced a new /wp/v2/media/{id}/post-process endpoint, which may be hit with a POST to resume media processing in the event the initial POST to /wp/v2/media fails. Clients may know to utilize this new endpoint through the presence of a new non-standard header X-WP-Upload-Attachment-ID, but @rmccue caught that we do not provide any Link-based method of discovering the existence of this endpoint from the initial media collection. @TimothyBlynJacobs proposes using the edit-media relation for this link.

We should add an additional Link to the header of the failing POST response (or any POST response, potentially, with the understanding a link is only necessary in the event of failure). Implementing this Link was punted from 5.3 because the $response object on which we can call add_link was not available at the time we set the initial X-header, which we can work around but did not have time to resolve before the final 5.3 beta.

Aside: If we're able to resolve the order-of-operations issue, it's possible that the Link could become the preferred method of signalling that post-processing should occur, rather than the non-standard header. However the X-header is more appropriate for the other media paths in media.php and admin-ajax.php, so this may not be feasible.

Change History (0)

Note: See TracTickets for help on using tickets.