declare function as:json-response-headers()
{
<rest:response>
<http:response status="404">
<http:header name="Content-Language" value="el"/>
<http:header name="Content-Type" value="application/json; charset=utf-8"/>
</http:response>
</rest:response>
};
declare
%rest:path("/api/abbott-smith/index")
%rest:GET
%rest:produces("application/json")
function as:index()
{
as:json-response-headers(),
array { $as:abbott-smith/*:entry ! @lemma ! string() }
! serialize(., map {'method' : 'json'})
};
Hi Jonathan,Have you tried setting the media-type or method parameters to application/json instead of only the produces parameter, as explained here [1].Best regards,Kristian KankainenOn 11. Nov 2021, at 02:32, Jonathan Robie <jonathan.robie@gmail.com> wrote:Using RESTXQ in an application for the first time. I expected this function to have the MIME type application/json:declare%rest:path("/api/abbott-smith/index")%rest:GET%rest:produces("application/json")function as:index(){array { $as:abbott-smith/*:entry ! @lemma ! string() }! serialize(., map {'method' : 'json'})};But both POSTMAN and WADL give me application/xml as the mime type:<wadl:resource path="/api/abbott-smith/index">
<wadl:method name="GET">
<wadl:request/>
<wadl:response>
<wadl:representation mediaType="application/xml"/>
</wadl:response>
</wadl:method>
</wadl:resource>
What am I doing wrong?Jonathan