Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,137 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have defined a function in python to call Power BI REST API - selective deploy pipelines.
def selective_deployment_pipeline(access_token: str, pipeline_id: str, source_stage_order: int, datasets_sid: str, report_sid: str): # require scope: Pipeline.Deploy
url = f"https://api.powerbi.com/v1.0/myorg/pipelines/{pipeline_id}/deploy"
print(url)
body={
"sourceStageOrder": source_stage_order,
"datasets": [
{
"sourceId": datasets_sid
}
],
"reports": [
{
"sourceId": report_sid
}
],
"options": {
"allowOverwriteArtifact": "true",
"allowCreateArtifact": "true"
},
"note": "Deploying business ready items"
}
#print(body)
headers = {'Authorization': f'Bearer {access_token}', "Accept": None}
response = requests.request("POST", url, headers=headers, data=body)
json_response = json.loads(response.text)
print("response:", json_response)
When i'm calling the script, although i've provided the datasets_id and reports_id altogether with rest of the required params, i got below error message:
response: {'error': {'code': 'BadRequest', 'message': 'Bad Request', 'details': [{'message': 'The SourceId property is required.', 'target': 'request.Datasets.SourceId'}, {'message': 'The SourceId property is required.', 'target': 'request.Reports.SourceId'}]}}
Please help. Thanks