Use templates: Rest API
Create and run a template over the ZenML Rest API
Last updated
Create and run a template over the ZenML Rest API
Last updated
This is a ZenML Pro-only feature. Please sign up here to get access.
Triggering a pipeline from the REST API only works if you've created at least one run template for that pipeline.
As a pre-requisite, you need a pipeline name. After you have it, there are three calls that need to be made in order to trigger a pipeline from the REST API:
GET /pipelines?name=<PIPELINE_NAME>
-> This returns a response, where a <PIPELINE_ID> can be copied
GET /run_templates?pipeline_id=<PIPELINE_ID>
-> This returns a list of responses where a <TEMPLATE_ID> can be chosen
POST /run_templates/<TEMPLATE_ID>/runs
-> This runs the pipeline. You can pass the PipelineRunConfiguration in the body
Learn how to get a bearer token for the curl commands here.
Here is an example. Let's say would we like to re-run a pipeline called training
. We first query the /pipelines
endpoint:
We can take the ID from any object in the list of responses. In this case, the <PIPELINE_ID> is c953985e-650a-4cbf-a03a-e49463f58473
in the response.
After this, we take the pipeline ID and call the/run_templates?pipeline_id=<PIPELINE_ID>
API:
We can now take the <TEMPLATE_ID> from this response. Here it is b826b714-a9b3-461c-9a6e-1bde3df3241d
.
Finally, we can use the template ID to trigger the pipeline with a different configuration:
A positive response means your pipeline has been re-triggered with a different config!