I'm using Mathematica 10.1.0 and I've created a simple API and deployed it to CloudAPI. Then when I try to use it via URLExecute, I always get a response that I need to login to the cloud.
I've logged in in the notebook using the CloudConnect function. Yet even after that I still get the same response.
If I provide the same login credentials I use to login to the Wolfram Cloud as the arguments to URLExecute as "Username" and "Password" options then it still fails and tells me I need to login to the cloud. (I put ... in place of them here)
Below are my notebook code and the responses that pass in the Username and Password explicitly. Any help or explanation would be greatly appreciated.
In[1]:= CloudConnect[]
Out[1]= "..."
In[3]:= func = APIFunction[{"x" -> "Integer"}, FactorInteger[#x] &];
In[4]:= APIFunction[{"x" -> "Integer"}, FactorInteger[#x] &]
Out[4]= APIFunction[{"x" -> "Integer"}, FactorInteger[#x] &]
In[5]:= api = CloudDeploy[func]
Out[5]= CloudObject["https://www.wolframcloud.com/objects/ab5a5cc1-\
e101-4200-8858-ca45072b1085"]
In[6]:= URLExecute["https://www.wolframcloud.com/objects/ab5a5cc1-\
e101-4200-8858-ca45072b1085",
{"x" -> "10"},
"Username" -> "...",
"Password" -> "..."
]
Out[6]= "Sign In with Your Wolfram ID
Email
Password
Remember me
Sign in
Forgot your password? Don't have a Wolfram ID? Create one . \
© 2018 Wolfram Research, Inc. | Terms | Privacy | Support"
This issue went away locally after a restart of Mathematica. Still not sure why it got confused as I had logged out and back in to Mathematica itself via Settings, so I know it was logging me in ok, bc I tested other calls that had to use the token to download data. Anyway, restart if you see this...