Message Boards Message Boards

Issues with Wolfram API to call another API

Posted 8 years ago

Hi, all. I've posted this question in the Mathematica StackExchange group, but I figured some might be interested/able to help so posting it here as well seemed like a good idea:

I've built a set of Wolfram APIs that call another API which builds specific queries given the parameters of a database and then outputs that query for the client in the appropriate query language syntax. Using URLExecute in the Mathematica notebook on the database URL itself works just fine, but the issue comes when trying to call the database API, and the issue has been narrowed down to the use of URLExecute in the body of APIFunction, which looks something like this:

"string1" -> "String",
"string2" -> "String"},
"format" -> "json",
"query" -> QueryBuilder[#string1, #string2]
"Method" -> "POST"] &]

When deploying the API to the cloud, the error message given was some kind of permission/configuration error. My question is, is there a way to work around this? Or is this pushing past the limits of the Wolfram Cloud capabilities? Was the Wolfram Cloud designed to handle these sorts of interactions? Some feedback would be awesome, because otherwise I think I've reached an indefinite roadblock with what I'm trying to do.

If this info helps, the permissions of the database cloud server is set to allow anyone to call information from it, and the permissions of the Wolfram Cloud server are set to public.

POSTED BY: Jesse Dohmann
8 Replies

It may well be quite easy to do what you are trying to do. To quickly find out if this is so, provide a URLExecute that demonstrates a successful API call from a Mathematica notebook to the Neo4j 7-Day Sandbox. Please also mention any required setup details for the sandbox.

Sorry if my reading comprehensions skills are failing, but are you saying that when you call CloudDeploy with an api function like the one you show that it fails or are you saying that when you try to call the api you successfully deployed you get an error result returned from URLExecute? Does the URLExecute call work from a notebook that you are running in the cloud? If you could include the actual failure result (the message or unexpected data) that would be helpful too.

POSTED BY: Andrew de Laix
Posted 8 years ago

Hi, Andrew. No worries, thanks for giving me the opportunity to clarify: URLExecute does work when calling in the cloud notebook, but cloud deployment with URLExecute in the body of APIFunction, such as the one above, fails. I've been trying to replicate the error result I got the first time, but now I'm just getting time out errors; the original error message said it was a configuration connection error. I don't really understand how Wolfram API is interacting with the database API to give you a more detailed answer.

POSTED BY: Jesse Dohmann

So, URLExecute should work when called from an api function and it does in fact work for me when I made a test api. To get any further, I'd have to try accessing the actual database to see if there's a particular problem communicating in this case. Is this a database I can access and could you provide a legal query?

POSTED BY: Andrew de Laix
Posted 8 years ago

Sure, here is the link to the database for you to try as the first argument for APIFunction (If you need to get to the actual Neo4j frontend, just delete everything after ~7474 in the URL). For the query, try this one as a test:


Also, I was able to get the original error message I encountered when I ran it thru my personal cloud account (which is different from the cloud account I was using before). Here it is:

"ERROR The requested URL could not be retrieved \n\n \n \nThe following error was encountered while trying to retrieve the URL: \nAccess Denied. \nAccess control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect. \nYour cache administrator is . \n \n\n \n \nGenerated Wed, 22 Jun 2016 14:50:23 GMT by (squid/3.5.9)"

POSTED BY: Jesse Dohmann

If I follow the link to the database I'm asked for a username and password, so I don't think I'm going to have much luck accessing it. Also, I'd need the code for QueryBuilder to use your code exactly.

POSTED BY: Andrew de Laix
Posted 8 years ago

Do you have a specific error message or any information on the external API (e.g. link to documentation)?

POSTED BY: Joel Klein
Posted 8 years ago

Hi Joel, I don't have the specific error message from the Wolfram Cloud object on hand anymore, but here is some documentation for the external API.

POSTED BY: Jesse Dohmann
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract