plugins/powerbi-master/skills/rest-api-automation/SKILL.md
Power BI REST API and Fabric REST API automation. PROACTIVELY activate for: (1) calling Power BI REST APIs, (2) embed-token generation (App Owns Data, User Owns Data), (3) service-principal authentication for Power BI, (4) dataset refresh API and refresh status polling, (5) push datasets and streaming, (6) Admin API (workspace/dataset enumeration), (7) Power BI Embedded and the JavaScript SDK (powerbi-client), (8) export-to-file API (PDF/PPTX/PNG), (9) Power BI automation via PowerShell (MicrosoftPowerBIMgmt), (10) Scanner API for tenant inventory, (11) app registration in Microsoft Entra ID. Provides: REST endpoint reference, OAuth/MSAL token recipes, embed-token patterns, refresh automation scripts, JavaScript SDK examples, and PowerShell module recipes.
npx skillsauth add JosiahSiegel/claude-plugin-marketplace rest-api-automationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The Power BI REST API provides programmatic access for embedding, administration, dataset management, and automation. The base URL is https://api.powerbi.com/v1.0/myorg/ for user context or https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/ for workspace context.
Get access token:
curl -X POST "https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id={clientId}&client_secret={secret}&scope=https://analysis.windows.net/powerbi/api/.default"
PowerShell:
$body = @{
grant_type = "client_credentials"
client_id = $clientId
client_secret = $clientSecret
scope = "https://analysis.windows.net/powerbi/api/.default"
}
$token = (Invoke-RestMethod -Uri "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" `
-Method Post -Body $body).access_token
Uses a real user account with username/password grant. Requires Pro/PPU license. Subject to MFA and Conditional Access issues. Avoid for production.
| Group | Base Path | Purpose |
|-------|-----------|---------|
| Datasets | /datasets | Manage semantic models, refresh, parameters |
| Reports | /reports | Get, clone, export, rebind reports |
| Dashboards | /dashboards | Get dashboards and tiles |
| Groups (Workspaces) | /groups | Workspace CRUD, membership |
| Imports | /imports | Upload PBIX/XLSX files |
| Pipelines | /pipelines | Deployment pipeline automation |
| Admin | /admin | Tenant-wide operations (scanner, activity) |
| EmbedToken | /GenerateToken | Create embed tokens |
| Gateways | /gateways | Gateway and data source management |
| Dataflows | /dataflows | Dataflow management |
| Apps | /apps | App management |
| Capacities | /capacities | Capacity management |
| Goals | /goals | Scorecards and goals |
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/refreshes
Authorization: Bearer {token}
Content-Type: application/json
{
"notifyOption": "MailOnFailure",
"retryCount": 2,
"type": "Full",
"commitMode": "transactional",
"applyRefreshPolicy": true
}
Enhanced refresh (selective tables/partitions):
{
"type": "Full",
"commitMode": "transactional",
"objects": [
{ "table": "Sales", "partition": "Sales_Current" },
{ "table": "Products" }
]
}
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/refreshes?$top=10
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/imports?datasetDisplayName=SalesReport&nameConflict=CreateOrOverwrite
Authorization: Bearer {token}
Content-Type: multipart/form-data
[PBIX file as form data]
Python:
import requests
url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/imports"
params = {"datasetDisplayName": "SalesReport", "nameConflict": "CreateOrOverwrite"}
headers = {"Authorization": f"Bearer {token}"}
with open("SalesReport.pbix", "rb") as f:
response = requests.post(url, params=params, headers=headers,
files={"file": ("SalesReport.pbix", f, "application/octet-stream")})
# Initiate export
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/ExportTo
{
"format": "PDF",
"powerBIReportConfiguration": {
"pages": [
{ "pageName": "ReportSection1" }
],
"defaultBookmark": { "name": "BookmarkName" }
}
}
# Poll for completion
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/exports/{exportId}
# Download when status is "Succeeded"
GET https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/exports/{exportId}/file
Supported formats: PDF, PPTX, PNG, XLSX, CSV, XML, MHTML, IMAGE, ACCESSIBLEPDF
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/Default.UpdateParameters
{
"updateDetails": [
{ "name": "ServerName", "newValue": "prod-server.database.windows.net" },
{ "name": "DatabaseName", "newValue": "ProdDB" }
]
}
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/Default.TakeOver
PATCH https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources/{datasourceId}
{
"credentialDetails": {
"credentialType": "OAuth2",
"credentials": "{\"credentialData\":[{\"name\":\"accessToken\",\"value\":\"...\"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "Organizational"
}
}
Create and push data to datasets via API for real-time dashboards:
# Create push dataset
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets
{
"name": "RealTimeMetrics",
"defaultMode": "Push",
"tables": [
{
"name": "Metrics",
"columns": [
{ "name": "Timestamp", "dataType": "DateTime" },
{ "name": "Sensor", "dataType": "String" },
{ "name": "Value", "dataType": "Double" },
{ "name": "Status", "dataType": "String" }
]
}
]
}
# Push rows
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/tables/Metrics/rows
{
"rows": [
{ "Timestamp": "2026-04-03T10:30:00Z", "Sensor": "Temp-01", "Value": 23.5, "Status": "Normal" },
{ "Timestamp": "2026-04-03T10:30:00Z", "Sensor": "Temp-02", "Value": 45.2, "Status": "Warning" }
]
}
# Clear table
DELETE https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/tables/Metrics/rows
POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/reports/{reportId}/GenerateToken
{
"accessLevel": "View",
"identities": [
{
"username": "[email protected]",
"roles": ["RegionManager"],
"datasets": ["{datasetId}"]
}
]
}
POST https://api.powerbi.com/v1.0/myorg/GenerateToken
{
"datasets": [
{ "id": "{datasetId}" }
],
"reports": [
{ "id": "{reportId}", "allowEdit": false }
],
"targetWorkspaces": [
{ "id": "{workspaceId}" }
],
"identities": [
{
"username": "[email protected]",
"roles": ["ViewerRole"],
"datasets": ["{datasetId}"]
}
]
}
<div id="reportContainer" style="height:600px;"></div>
<script src="https://cdn.jsdelivr.net/npm/powerbi-client/dist/powerbi.min.js"></script>
<script>
const embedConfig = {
type: 'report',
id: reportId,
embedUrl: embedUrl,
accessToken: embedToken,
tokenType: models.TokenType.Embed, // Use Embed for app-owns-data
settings: {
panes: {
filters: { visible: false },
pageNavigation: { visible: true }
},
bars: { statusBar: { visible: false } }
}
};
const container = document.getElementById('reportContainer');
const report = powerbi.embed(container, embedConfig);
// Token refresh handler
report.on('tokenExpired', async () => {
const newToken = await fetchNewToken(); // Call your backend
await report.setAccessToken(newToken);
});
// Event handlers
report.on('loaded', () => console.log('Report loaded'));
report.on('rendered', () => console.log('Report rendered'));
report.on('error', (event) => console.error(event.detail));
</script>
# Initiate scan
POST https://api.powerbi.com/v1.0/myorg/admin/workspaces/getInfo
{
"workspaces": ["{workspaceId1}", "{workspaceId2}"],
"datasetExpressions": true,
"datasetSchema": true,
"datasourceDetails": true,
"getArtifactUsers": true
}
# Get scan results
GET https://api.powerbi.com/v1.0/myorg/admin/workspaces/scanResult/{scanId}
GET https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2026-04-01T00:00:00Z'&endDateTime='2026-04-02T00:00:00Z'&$filter=Activity eq 'ViewReport'
GET https://api.powerbi.com/v1.0/myorg/admin/datasets?$top=100
references/api-endpoints-complete.md -- Complete API endpoint reference with all parameters, response schemas, and error codesdevelopment
This skill should be used when the user asks to train, debug, scale, or improve ML models. PROACTIVELY activate for: (1) PyTorch, TensorFlow/Keras, JAX, Flax, Hugging Face Trainer/Accelerate training loops, (2) distributed training, DDP/FSDP/DeepSpeed, TPU/GPU setup, (3) mixed precision AMP/bf16, gradient accumulation, checkpointing, seeding, (4) overfitting, imbalance, loss functions, regularization, LR schedules, warmup, (5) memory optimization, gradient checkpointing, offloading, quantization-aware training. Provides: reproducible training best practices across deep learning and classical ML.
development
This skill should be used when the user asks to productionize, track, version, govern, monitor, or automate ML systems. PROACTIVELY activate for: (1) MLflow, Weights & Biases, Neptune, Comet, ClearML experiment tracking, (2) model registry, model versioning, artifact lineage, reproducibility, (3) Kubeflow, SageMaker Pipelines, Vertex AI Pipelines, Azure ML pipelines, Databricks workflows, (4) CI/CD, continuous training/evaluation, A/B tests, canary/shadow deployments, (5) drift detection, model monitoring, data validation, responsible AI governance. Provides: end-to-end MLOps architecture and operational safeguards.
development
This skill should be used when the user asks to optimize, export, serve, compress, or accelerate ML inference. PROACTIVELY activate for: (1) latency, throughput, p95/p99, batching, concurrency, KV cache, memory, or cost issues, (2) quantization INT8/INT4, GPTQ, AWQ, bitsandbytes, pruning, sparsity, distillation, (3) ONNX export, ONNX Runtime, TensorRT, TorchScript, torch.compile, XLA, OpenVINO, Core ML, TFLite, (4) Triton, TorchServe, TF Serving, BentoML, Seldon, KServe configuration, (5) edge deployment, CPU/GPU/TPU/Inferentia serving. Provides: hardware-aware inference optimization and safe benchmarking.
testing
This skill should be used when the user asks to tune hyperparameters, run sweeps, optimize search spaces, or use AutoML. PROACTIVELY activate for: (1) Optuna, Ray Tune, FLAML, AutoGluon, Hyperopt, Nevergrad, KerasTuner, W&B sweeps, (2) grid search, random search, Bayesian optimization, TPE, Gaussian processes, evolutionary search, (3) ASHA, Hyperband, successive halving, multi-fidelity optimization, population-based training, (4) learning-rate finder, batch-size search, early stopping, pruning, (5) reproducible sweep design and experiment analysis. Provides: budget-aware hyperparameter search strategy.