2
$\begingroup$

I have a very simple question. I don't know how to pass multiple parameters to a web deployed APIFunction.

I created a function:

func = APIFunction[{"t" -> "Real", "y"->"Real"}, #t*#y &];
api = CloudDeploy[func, Permissions -> "Public"]   

and Mathematica gave me the link to the webdeployed function. I know that I can pass a single parameter by just adding ?{Parameter} to the url. But what do I have to do, to pass t and y?

I couldn't find it.

Thank you very much!

$\endgroup$
1
  • 2
    $\begingroup$ Just use yourURL?t=1.1&y=3.2 $\endgroup$
    – Carl Woll
    Commented Nov 4, 2017 at 2:58

1 Answer 1

2
$\begingroup$
func = APIFunction[{"t" -> "Real", "y"->"Real"}, #t*#y &];
api = CloudDeploy[func, Permissions -> "Public"]   

You don't need to access it via browser. There are functions for that:

URLExecute[api, {"t" -> 1, "y" -> 5}]
5.

But if you insist:

URLBuild[First@api, {"t" -> 1, "y" -> 5}] // Echo // SystemOpen

>> https://www.wolframcloud.com/...........?t=1&y=5

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.