I checked with developers on this and found out that BaseForm assumes a Mathematica-like front end.
That is why it works in Wolfram Programming Cloud.
BaseForm is interpreted by the FE to print the number in that form in a notebook. By default CloudDeploy returns Wolfram Language so the result he is seeing isn’t formatted because it is WL that is not displayed in a notebook. I tried
with HTML output and got closer to the expected result, but the formatting isn’t perfect. This format is probably closer to the user intention, though.
According to the documentation, BaseForm is interpreted by the notebook interface to display a certain way, but it does not affect evaluation. When you CloudDeploy an APIFunction, its output format is Wolfram Language by default, so you’re seeing what’s expected.
There are several options, depending on what you’re going for:
Give the output as an image, specifying the “PNG” format as a second argument to APIFunction:
Make the output text format by running BaseForm through ToString, and specifying “Text” format. The base is put on a second line to show it as a subscript:
Marco, what you’re seeing there isn’t a result of setting Permissions->“Public”. Note that your APIFunction expression ends in a semicolon. What you actually ended up CloudDeploying is the result of calling func with some arguments, which is a simple expression. By default, CloudDeploy of an expression is rendered as a notebook as you showed.