WORKFLOW
Call a Wolfram API from an External Program
Run Wolfram Language code from external programs written in C++, C#, Python, Java, JavaScript and other languages.
Create an APIFunction
Create a simple APIFunction that adds 3 to an integer argument:
Deploy the APIFunction to the Wolfram Cloud
Deploy the function to the cloud with Permissions->"Public" to make the API available to anyone:
Get the embed code for the APIFunction
Get the code for calling the API from Python with EmbedCode. Click Copy to Clipboard to copy the embed code to the clipboard:
Paste the embed code into source code
Paste the embed code into a Python script:
Run the program, calling the Wolfram Language API
Run the Python script, which calls Wolfram Language code to add 3 to 6:
$ ./APITest.py
9
Notes
To call an API function programmatically from the Wolfram Language, use URLExecute and provide the API arguments in a list:
- For HTTP POST requests, use HTTPRequest with Method "POST" instead of URLExecute.