Group Abstract Group Abstract

Message Boards Message Boards

Front End/Back End design?

Posted 9 years ago

Background Info: I have created a notebook (in the Wolfram Language using the Desktop environment) that generates a user interface. I have also created 15 other notebooks that generate different kinds of data for the interface, if the user calls for it. Currently the 15 "back end" notebooks are set up as APIFunctions and can be deployed so that a $post request from an HTML page or query via a URL will return the data. That was fine when my front end was an HTML page, but now I'm trying to switch it so that the user interface is written in Wolfram Language (Grid[], Pane[], Button[], etc.) instead of HTML.

Main Question: What functions do I need to use so that the front end UI (notebook? Instant API?) asks for and gets data from the back end (cloud object? Instant API?)?

Obviously, I'm a beginner in the Wolfram Language, so please be patient with my cluelessness, and answer in a way that will make sense to me as I climb the learning curve. : )

Thanks in advance,

Mark

POSTED BY: Mark Greenberg
5 Replies
Posted 9 years ago

As so often happens, a good night's sleep and fresh eyes suggest solutions to what the night before seemed like an intractable obstacle. This morning I realized that if the back end was displaying data in a browser window, but returned $Failed when called by my front-end code, then there was something wrong with the front-end code. I rewrote the critical parts of the code, those quoted above. To my surprise and delight, it worked perfectly (okay, not perfectly, but it did work). Even the images came through, though they were being sent as humongous strings of RGB values!

So why didn't it work before? I'm not positive, but here is a possible explanation: I was copying the URL for the HTTPRequest function from the output cell when I deployed a back-end cloud object, and pasting it inside the brackets of the HTTPRequest function. After I would type quotation marks around the URL, sometimes the color-coding would indicate that it still wasn't a string. I dismissed this as a glitch in the color coding. The code, when run, would also say that I lacked a closing ] when in fact the ] was there. I have come to realize that there are a lot of hidden characters in Wolfram code (escape characters, cell formatting characters, etc.) that you can't see unless you examine the FullForm of it, and I now believe that the URLs I was copying must have contained hidden characters that prevented the code from working.

In any event, it is now working well enough for me to proceed with the project. It's a hobby project of mineĀ—serious, but not commercial. If anyone is interested to know more about it (or even contribute), let me know. We can communicate further outside of the forum.

POSTED BY: Mark Greenberg
Posted 9 years ago
POSTED BY: Mark Greenberg

You'll want to use the new version 11 function HTTPRequest.

I'd be delighted to see you post a simple code example that demonstrates how an HTTPRequest in your front end UI notebook calls a back end instant API cloud object.

Posted 9 years ago

Sounds like just what I need, but I cannot seem to find a link to upgrade/download version 11 of the Wolfram Desktop. Any thoughts on where I might get the new version?

POSTED BY: Mark Greenberg

Sign in (or create an account) on the Wolfram User Portal. On the My Products and Services page there should be an Upgrade Available link, or contact Wolfram Sales.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard