Need API Response in HTML Format

Hi,
I am hitting the URL to get a response in HTML Format. But I could not able to get it. I have added the header as Accept - text/html. But still, I could not able to visualize it in HTML Format. I have attached the image of the response which I got.


Could anyone please give me some suggestions?
Thank you.

Hi @imurein

The server response looks like JSON. If you display this as HTML in the visualiser you will likely only see it as plain text.

The header you have added is the request header and won’t change the response (it only effects the data being sent to the server, not that coming back).

To change the response header you would need access to the code being sent back from the server. Which (as far as I’m aware) would be either dev code or mock servers.


You can try visualising it using something like this:

const jsonData = pm.response.text()

pm.visualizer.set(`
<body>
<P>${jsonData}
</body>
`);

Hope this helps.

Hi @w4dd325,

Ok, I got it. thanks for your insights on this. I was little doubt about that. Now It is clarified.