Okay, so I installed version 11 of the Wolfram Desktop programming environment. Thanks for pushing me that direction, Christopher. And now the function HTTPRequest is available to me. I've been playing around with that function and my existing constructs, but I'm not quite clear yet on how it all should work.
My backend cloud objects output a list of four items:
- a question in the form of a string, or a Wolfram expression, or a combo of both
- a number representing which of the four choices is the correct answer
- a list of four choices, each of which could be a string, an expression, or a number
- an image (or Null if the question has no image)
I have 15 notebooks, each for a different category of question (algebra, anatomy, etc.). Right now, each notebook can generate five different kinds of questions (answers, choices, images). When I deploy the notebooks, they still produce the four pieces of data, but in a string representation.
Here is a link to the "Numbers" category cloud object. If you refresh the browser window, it will randomly generate a new set of data each time.
As mentioned above, the front-end user interface was originally an HTML page using Javascript for interactivity and MathJax to format the math. I ran into too many limitations with this setup, especially formatting the math. (The TeXForm function, for example, didn't work when deploying to the cloud, so I had to manually format all the LaTex markup.) Before long, I began to think that a better way to accomplish my goal was to make the interface in Wolfram Language.
So I wrote enough of the interface in Wolfram Language to check whether I can request and get data from the back end files, and then work that data into the user interface. So far, the "Numbers" data goes into the UI perfectly, even the Wolfram expressions display properly. However, all of the other backend cloud objects I've tried return $Failed instead of the data to the UI. They seem to return valid data when accessed through a browser:
algebra cloud object
geometry cloud object
The code I am using to request and then parse the data is this:
req = HTTPRequest[ "https://www.wolframcloud.com/objects/655db1d7-b9c7-40f4-8672-4cb58988dbf6"];
reply = URLRead[req];
returnData = ToExpression[reply["Body"]];
q = returnData[[1]];
ans = returnData[[2]];
mixed = returnData[[3]];
pic = returnData[[4]];
After I parse it, I display the various parts (question, choices, and image) as appropriate in the user interface.
I am still learning all of this (HTTP requests, Wolfram programming, etc.) so it is hard to isolate what the problem might be. And although I'm not there yet, I know that images and graphics objects will be an issue because right now that data is being returned as super-long strings.
Any help would be appreciated. I could share files/code outside of the discussion if that is better.
Thanks,
Mark