Forum Discussion
Execute Data Pipeline Via API
- Anonymous2 years ago
Hello Anonymous ,
The Job Scheduler API is missing documentation when it comes to the jobType parameter. If you are trying to run a Data Pipeline on demand, don't use DefaultJob like this.
/jobs/instances?jobType=DefaultJob
Instead, use Pipeline like this.
/jobs/instances?jobType=Pipeline
One additional comment to the solution:
1. If you need to pass parameters to the pipeline, you need to provide a payload/body in the following format:
{ "executionData": {
"parameters": {
"YourParameter1": 1,
"YourParameter2": "Param2
}
}
}
Tip: if you want to call Fabric APIs from a Fabrik Notebook you can use the semantic link library. This is also a great way of verifying/testing the API calls directly within Fabric:
# Install sempy version 0.4.0 or higher
!pip install semantic-link --q
import sempy.fabric as fabric
# Init the sempy client
client = fabric.FabricRestClient()
# Fabric REST API call “Job Scheduler – Run On Demand Item Job”
# Docs: Job Scheduler - Run On Demand Item Job - REST API (Core) | https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/run-on-demand-item-job
# HTTP: POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items/{itemId}/jobs/instances?jobType={jobType}
# Body/Payload: {"executionData": { ... } }
# Get the default workspace id of the notebook
workspaceId = fabric.get_workspace_id()
itemId = f"yourPipelineUuid"
jobType = f"Pipeline"
payload = {
"executionData": {
"parameters": {
"YourParamter1": 1,
"YourParamter2": "Param2"
}
}
}
# Call Fabric REST API with semantic link Fabric REST client (sempy)
# Run without payload / no or default pipeline parameters
response = client.post(f"/v1/workspaces/{workspaceId}/items/{itemId}/jobs/instances?jobType={jobType}")
# Run with payload / pipeline parameters
response = client.post(f"/v1/workspaces/{workspaceId}/items/{itemId}/jobs/instances?jobType={jobType}",json= payload)
- richbenmintz1 year agoResident Rockstar
please add this to the documentation, the docs make no mention of how you should construct the parameters or the appropriate jobtypes
- 7effrey1 year agoMicrosoft Employee