Hi Michael,
The API returns an HTML page
1) Is your response like text/HTML format, like below as a string
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
For this, you can set the response variable in
If so, you can store it in a string attribute and use an HTML Element to show the HTML in UI.
** Note: if you have a full HTML code, the styles element in the header might not apply; prefer inline-styled HTML if possible.
Or if you have the same format(fixed) for all API's then you can add the styles in Mendix when developing and let them get applied/ you can also style them from your app once on how a table should look. and add the parent class to activate styles specific to api resulted ones.
2) Or a URL/ link as a string like 'https://exampl.com', then follow below, you can set styles and other attributes in the HTML Attributes section
If the API returns an image (e.g., image/jpeg
)
Create an entity ApiImage
that generalizes System.Image
(no extra attributes needed).
Microflow (on a button):
Create object ApiImage
(set Name = “m11.jpg” optional).
Call REST (GET) → Response handling = “Store in a file document” → target $ApiImage.
Add header Accept: image/jpeg (if needed).
Add Authorization header if the API needs it.
Commit $ApiImage (optional).
Show page with a Data view of ApiImage
and an Image widget inside.(Alternative: use Download file on $ApiImage to open it in a new browser tab.)
If the API returns a PDF (application/pdf
)
Create an entity ApiFile
that generalizes System.FileDocument
.
Same microflow pattern as above, but:
Response handling → Store in a file document → $ApiFile.
Header Accept: application/pdf (if needed).
After the call, use Download file ($ApiFile) to open in a new tab, or place a PDF/File viewer widget on a page bound to $ApiFile
.
If the API returns an HTML page
Easiest: use a Link button or Open URL microflow action to open the API URL in a new tab.
Embedding via iframe works only if the server allows it (no X-Frame-Options: DENY
).
Common gotchas
Don’t use “Apply mapping/Convert to string” for images/PDFs—use “Store in a file document.”
Make sure required headers (Authorization, Accept) are set.
If you get an empty file, the call likely failed auth; check the HTTP Response (status/body) in the Call REST activity.
Hi,
Thank you for your response. I am focusing on HTML:
If the API returns an HTML page
Easiest: use a Link button or Open URL microflow action to open the API URL in a new tab.
In relation to the Open URL microflow action you mention - I am unable to locate this feature from either a microflow activity or functionality. I would be grateful if you could elaborate, my apologies.
My Microflow currently look like this:
In relation to using a Link button, again I am a bit confused as to how to achieve this - In terms of the response handling, I tried to store this in a string (and other options) but do not see how I can include this on a page outside of the microflow - I tried the link button but was not able to use this to include the variable created via the Call REST Response tab.
Any further assistance is greatly appreciated,
Regards,
Michael
Thanks Mohana Vyshnavi,
I was able to solve the problem by constructing a string of the api + parameters and then passing that string to a link button - this opens a new browser window with the results.
I would prefer to have the results displayed in Mendix so attempted your method. The steps I took:
Created a microflow and used the string of the api + parameters as the Location
I then selected Store in a string as Response Handling from the Response tab
I then create a blank page to use the variable Analysis_results via HTML ELement
However, the variable does not appear - can you tell me what I am doing wrong from the screenshots?
NOTE: I also tried to store the string containing the response to a string attribute in an entity and then calling that from HTML Element but as this is an object it cannot be used.
Thanks for any help with this
Regards,
Michael