This example, demonstrates how to run a flow that was created inside of the Nura Flow UI from the API. This example assumes you have already enabled developer settings on your account.
For a specific API reference, you can view the Nura Flow API Reference.
To follow this guide, you must first opt in for developer features by following the developer account guide.
This guide also assumes that an API key is created by visiting the api key guide.
We will demonstrate this example with a simple flow that loads a video and save it to the project gallery. You can replicate this example by recreating the flow shown below.
Upload video > Save to Gallery
The developer API uses "versions" of a specific blueprint instead of the blueprint itself. This way, if a modification is applied to the blueprint, the behavior of the version will remain the same.
To create a version of a blueprint, you can navigate to the "versions" tab of a blueprint.
Project > Version
After this is completed, you can create a new version by clicking the "New Version" button, and following the instructions found in the dialog.
Using the API reference for running a blueprint.
curlcurl -X POST \ -H "Content-Type: application/json" \ -H "flow-api-key: your_api_key_here" \ -d '{"versionId": "your_version_id", "nodeValues": {"key": "value"}}' \ https://flowapp.nuraml.com/api/blueprint/run
Using the API key that was previously created.
Where the versionId is the id found after creating a new version.
and the nodeValues being a set of values to provide as input into your run blueprint
You can find the example struct of the values by viewing more on your specific version.
This api request will respond with a task id that can be used to check the status of the task.
To check the status of a task, you can use the API reference for fetching a task.
curlcurl -X GET \ -H "Content-Type: application/json" \ -H "flow-api-key: your_api_key_here" \ "https://flowapp.nuraml.com/api/task/retrieve?id=<task_id>"
Once again using the API key that was previously created.
Using the task id that was returned from the previous run blueprint request as a query parameter.
That concludes the example where we versioned a blueprint, invoked the blueprint through the API and waited for the task to complete.