Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force Chrome Postman to return application/xml instead of application/octect-stream

I am using google chrome plugin Postman for testing some restful web services. Some of my webservices have a produces annotation that has several types defined. Each time I run one of my services though, it seems postman's results are determined to always return in octect-stream form. Is there a way to force postman (or potentially my service) to return application/xml results? I would prefer not to change the annotation but will if thats my only choice.

My service definition -

@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, 
"application/x-javascript", MediaType.APPLICATION_OCTET_STREAM } )
@Path( "/getCustomers/" )
public Response getCustomers

My postman call is just a GET call with no parameters on the header like this:

http://myserver:8080/test/getCustomers
like image 870
spartikus Avatar asked Aug 26 '13 22:08

spartikus


People also ask

How do I hit XML API in Postman?

Set the request method to POST . Under the Body tab, set the body type to raw and select XML from the dropdown. Once you add XML data as the body, Postman will automatically add a Content-Type header that can be seen under the Headers tab. While REST typically uses JSON and other data formats, SOAP relies on XML.

Can Rest return XML?

Data types that REST API can return are as follows: JSON (JavaScript Object Notation) XML. HTML.


1 Answers

Maybe your default response type is octect-stream

Use the below http headers in POSTMAN

Accept: application/xml

Do the server validations based on Accept headers.

like image 70
Suresh Avatar answered Sep 19 '22 11:09

Suresh