API automations

Getting the API Key

The first step is to obtain the API key in the Settings menu of the administration portal.

It is also possible to generate authentication keys based on permissions, with the administrator being able to generate keys that will allow access only to a subset of endpoints.

Managing Users via the API

The API documentation can be accessed herearrow-up-right. Using the GET /api/user route, you can list users in the system.

curl -X 'GET' \
  'https://api.powerembedded.com.br/api/user' \
  -H 'accept: application/json' \
  -H 'X-API-Key: HNhlHXAG1g21NyIsIkFwaUtleSI6Ik'

Example server response, where the "reports" property contains an array with all the IDs of the reports my user has access to, and "groups" points to an array with all the groups my user belongs to.

{
  "pageIndex": 1,
  "totalPages": 2,
  "hasNextPage": true,
  "hasPreviousPage": false,
  "data": [
    {
      "id": "dd668e6d-4f83-4715-a155-b55213677dd8",
      "email": "[email protected]",
      "name": "Example User",
      "role": 3,
      "reports": [
        "c3aa3e62-7c43-4c0f-ab1d-3f9e0fbbad0e",
        "57e23242-ad69-455b-8955-1a0b4e35e6ed",
        "359a3241-08e2-45d1-b046-78c3c9c7ea8f",
        "7c8a79ec-23d0-4edc-8299-89461e134c34",
        "48dc89e1-240d-4b25-bba2-e8cb2d3d16d4",
        "9339a616-9d09-49dd-a848-3289161b2c2a"
      ],
      "companies": [],
      "groups": [
        "5d47cdd0-bd05-4e27-a87a-45b45da4360e",
        "833e6b83-f157-47ef-9f1f-7545d705c5a1"
      ],
      "reportLandingPage": null,
      "department": "BI ",
      "expirationDate": null,
      "windowsAdUser": null,
      "canEditReport": true,
      "canCreateReport": false,
      "canOverwriteReport": false
    }
  ]
}

To filter the user list by name and email, simply use the query parameters "name" and "email", respectively.

To create a new user in the system, use the POST /api/user route. The "role" key defines the user rolearrow-up-right:

  1. Administrator

  2. Contributor

  3. Viewer

  4. Workspace Contributor

To delete a user from the system, use the DELETE /api/user/{userEmail} route, where "userEmail" is the email of the user to be deleted.

Controlling Report Permissions via the API

You can also grant access permission to one or more reports for a user using the PUT /api/user/link-reports route. Simply pass the report IDs in the "reports" array and the user's email in "userEmail".

To remove access permission for one or more reports, simply use the PUT /api/user/unlink-reports route.

Listing Existing Reports in Power Embedded

In addition to listing users, it is also possible to list reports. This way, you can access some metadata, such as report IDs. To do this, simply use the GET /api/report route.

Example server response.

Just like the users endpoint, it is also possible to filter reports using query parameters. In the example below, I use the "reportName" and "workspaceName" parameters.

Server response.

Row-Level Security (RLS) Using the API

To list all roles linked to your datasets, simply use the GET /api/datasets/rls route.

Server response.

It is also possible to use query parameters. In the example below, I provided a dataset ID in the "datasetId" parameter.

Server response.

To link an RLS role to a user or group, you can use the PUT /api/datasets/rls/link-users and PUT /api/datasets/rls/link-groups routes, respectively. To unlink, use /unlink-users and /unlink-groups.

Below is an example with PUT /api/datasets/rls/link-users.

Querying the Power Embedded Report Access Log via API

You can also use the GET /api/report-audit route to access the report audit log, querying all report accesses made by Power Embedded users.

Server response.

It is also possible to filter by query parameters, such as "userEmail", "reportName", "pageNumber", among others.

How to Display Power BI Reports in Your Application

circle-info

To learn more about displaying reports in external applications, visit the page Show reports in your system.

Documentation

Full API documentation: Swagger UI (powerembedded.com.br)arrow-up-right

API demonstration page for embedding reports: Demo - PowerPortal.IntegrationDemo (powerembedded.com.br)arrow-up-right

Last updated