Item12932: Allow REST to accept the contenttype parameter
Current State: Proposal Required
Released In: n/a
Target Release: minor
It is possible to pass the GET Param "contenttype" to a topic on view, to define the response Content-Type.
Would it be possible that we can pass this Param also to a rest call (/wiki/bin/rest/...)?
- 04 Jun 2014
does not process or pass through the content type. REST handlers have two implementation options:
- Return the results at the end of processing.
writeCompletePage with the content, and the core returns it as
- Handle the output directly. The REST handler is then free to set whatever content type and status code that it wants. So this depends upon the implementation of the handler.
I could see this being a rather minor enhancement, possibly for 1.2. This would make
So the general implementation:
- In the
UI::Rest handler, validate the
contenttype parameter for possible use if provided.
- Change the REST API to return either the simple results, or an array
UI::Rest, process the return from the REST handler as follows:
- If return is empty, do nothing. The handler generated any output.
- If return is an array, use the provided contenttype in the response
- If return is a simple string, validate the urlparam
contenttype, otherwise default to text/html.
- If a result is available
$session->writeCompletePage( $response, 'rest', $contentType );
- 07 Jun 2014
Deferring this to Foswiki 2.0
- 24 Apr 2015
Deferring to 2.1.
- 06 Jul 2015 - 03:27
As this is an API change, it really should have a proposal. Deferring to a future release.
- 17 Dec 2015