Need API Response in HTML Format

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 in HTML Format. I have attached the image of the response which I got.

Could you please give me some suggestions?
Thank you.

From personal experience you need to add pm.visualizer to the test tab, you can find the brewery tutorial to guide you through it (recommended) but this is the gist of the code

let template=`
    <style type="text/css">
        body: {background-color:#e0ffff;}

        {{#each response}}
            <p>website: {{website_url}}</p>
             <address>{{street}}<br/>{{city}}, {{postal_code}}</address>



pm.visualizer.set(template, {response: pm.response.json()});

Hi @imurein

The ‘Content-Type’ header would need to be in the response headers, not the request headers.
The request headers are those that you would send with your GET request.
The response headers are those that are sent back to you from the server.

more info on Content-Type here;

It’s also worth noting that the response in your screenshot, generally speaking, doesn’t look like HTML, it looks more like JSON to me.

So if you want to visualise this in HTML format, I think you would have to try out @dxlmx’s suggestion.

Hope that helps?

1 Like

Sorry for the inconvenience and for the delayed response. This post is mistakenly created again.
Thanks for your @dxlmx response. This code is useful for visualize in HTML format. But I want to get the response itself in HTML format. [I got the reply from @w4dd325 in another post which I have created in the same topic. Content type response cannot be changed by changing the Content type request header]
and @w4dd325 Thank you for the response. Both replies are useful for me.

1 Like

You’re quite welcome and hope you get the answer you need. I’m also currently trying to bring the backend response to the frontend. And finding the answer has been difficult. Good luck!

1 Like

@imurein I just found this series on yt that might be helpful. I’ll be trying this out today

it was very clear. The vid I’m referring to is the 2nd in the series.

1 Like

The second video is mock servers right?
Is the content coming back from a mock server or an actual API endpoint?

The response still looks like it is written in JSON, so outputting as HTML would probably result in it being displayed in plain text.

Struggling to follow what you are trying to achieve. But happy to try and help if you could dumb it down for me?


Would something like this help?
This shows the JSON in visualizer.

const jsonData = pm.response.text()

var template = `



1 Like

or this;

const jsonData = pm.response.text()



1 Like

To display in HTML you’d have to create an HTML file and append the data to the HTML element with JavaScript.

Hi have this example of putting JSON properties into a table;
The same approach could be taken but with an HTML template instead of just a table…


var template = `
    <style type="text/css">
        .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}
        .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}
        .tftable tr {background-color:#ffffff;}
        .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}
        .tftable tr:hover {background-color:#e0ffff;}
    <table class="tftable" border="1">
            <tr id=row_{{@key}} onClick="handleClick(">
                <td id={{@key}}>{{name}}</td>

pm.visualizer.set(template, {
    response: pm.response.json()