Skip to content

fab_api

Call any REST endpoint fab has no verb for: fab api <endpoint> -X <method>.

Step fragments below go under steps: in a hooks file. Shared keys such as environments and on_error are listed under Steps.

- action: fab_api
  endpoint: workspaces/{{ workspace_id }}/reports
  method: GET                        # default
  audience: fabric                   # default
  on_error: fail                     # default: stop the deploy here; `continue` logs it and goes on

Keys

Key Required Description
endpoint yes The path after the API's base URL. Use placeholders for ids: {{ workspace_id }}, {{ items.<Name>.<Type>.id }}.
method no GET (default), POST, PATCH, PUT, DELETE.
payload no A mapping, sent as the JSON body.
audience no Which API: fabric (default, api.fabric.microsoft.com/v1), powerbi (api.powerbi.com/v1.0/myorg; the endpoint starts after myorg/), azure or storage.

Behaviour

Any response that is not 2xx fails the step. The response is not kept. If a step needs the result of one call in another call, write a hook of your own.

Examples

Take over a semantic model

Power BI refuses a model's data-source and refresh calls from anyone but its owner. Before the publish, make the deploying identity the owner. on_error: continue because an empty workspace has no model yet:

pre_deploy_hooks: takeover.hooks.yml
- name: Take over the semantic model
  action: fab_api
  audience: powerbi
  method: POST
  endpoint: groups/{{ workspace_id }}/datasets/{{ items.<Name>.SemanticModel.id }}/Default.TakeOver
  on_error: continue

Schedule a model's refresh in prod

A semantic model's refresh schedule lives in Power BI (other items' schedules):

- name: Schedule the nightly refresh
  action: fab_api
  audience: powerbi
  method: PATCH
  endpoint: groups/{{ workspace_id }}/datasets/{{ items.<Name>.SemanticModel.id }}/refreshSchedule
  environments: [prod]
  payload:
    value:
      enabled: true
      days: [Monday, Tuesday, Wednesday, Thursday, Friday]
      times: ["02:30"]
      localTimeZoneId: UTC
      notifyOption: NoNotification

Read back what was deployed

- name: Read back the deployed reports
  action: fab_api
  endpoint: workspaces/{{ workspace_id }}/reports