[wp-trac] [WordPress Trac] #47834: Allow un-encoded output / other content types

WordPress Trac noreply at wordpress.org
Tue Aug 6 18:54:39 UTC 2019


#47834: Allow un-encoded output / other content types
-------------------------+------------------------------
 Reporter:  lkf_tanzt    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  REST API     |     Version:  5.2.2
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by lkf_tanzt):

 Yeah, I know JSON is the standard format and I like and use it a lot. But
 – in theory – REST is only an architectural design and
 [https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation.pdf
 Fielding] did not define a content format for the representations
 provided.

 My use case is a quite simple event plugin. I want to provide alternative
 representations for the events. To do this I want to provide a route where
 the client can define the needed format. Examples:

 * `application/json` to use the event data in a JS application
 * `text/calendar` (the thing which caused the issue) this is used to
 provide iCalendar / ics files according to
 [https://tools.ietf.org/html/rfc5545 RFC 5545]
 * `application/pdf` (another possible format) to allow the user to
 download a specially formatted PDF file of a events list

 So I want to use the REST API to provide the format the client requires. I
 might use the [https://developer.mozilla.org/en-
 US/docs/Web/HTTP/Headers/Accept Accept-Header] and content negotiation to
 process the requested format and return it with the corresponding Content-
 Type-Header.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47834#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list