How can I leverage AIP Logic from another external application not in Foundry ?
For instance, I have built some useful AIP Logic in Foundry, tested, but I need and want to call it from outside Foundry. How can I do so ?
How can I leverage AIP Logic from another external application not in Foundry ?
For instance, I have built some useful AIP Logic in Foundry, tested, but I need and want to call it from outside Foundry. How can I do so ?
Here are the steps to leverage your AIP Logic from outside of Foundry:
Example of python script that would hit the function endpoint:
import json
import requests
headers = {
"Authorization": "Bearer <your_secret_token>",
'Content-Type': 'application/json',
}
# Note: The actual payload, endpoints, etc. might vary. This script is given as an example, but you should use the generated documentation in Foundry
value = "<some payload you want to pass to the AIP Logic, if that's a simple string>"
# "topic" is an actual input of my AIP Logic
data = {
"parameters": {
"topic": value
}
}
response = requests.post(url="YOUR_FOUNDRY_URL/api/v2/ontologies/<rid generation by OSDK>/queries/<API name of your AIP Logic>/execute", headers=headers, data=json.dumps(data))
print(response.text)
Result:
{"value":"<this is the response generated by the AIP Logic if it is a simple string> ..."}
Ontology SDK allows you to call functions on Foundry using REST API, Python SDK and TypeScript SDK. You can do that by creating a Developer Console Application and generating your SDK as described here
When building API logic you can click on the Publish
and set the Function API name in the dialog
Once published you will be able to select the function by it’s API names in the function selector on the Developer console
NOTE
You will have to include any resource used by the Logic function in your Developer console application, otherwise you will see a permission error when trying to call the logic function.
Once you save and generate a new version of the SDK you can use the custom API Documentation to call this function in REST, Python or TypeScript