Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zah33r
New Member

Rest API Call from Custom Visual

Hi Everyone,

 

I am new to power bi development and trying to achieve below scenario.

I am trying to make a REST API call through the Custom Visual created in javascript. But unable to perform the action successfully.

I can see below error in chrome dev tools console, once my custom visual appears in the report: 

 

Refused to connect to 'https://xxxxxxxxxx/Data.json' because it violates the following Content Security Policy directive: "default-src https://app.powerbi.com data: blob: 'unsafe-inline' 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

 

Is it possible to make a restful api within the limits of Custom Visual? or if there's another appropriate method of achieving this?

Thanks,

Zaheer

2 REPLIES 2
chandanmanna48
New Member

Hi,
You need to specify the RestAPI endpoint inside capabilities.json, Below is the code for your reference

"privileges": [
        {
            "name": "WebAccess",
            "essential": true,
            "parameters": ["http://localhost:44353"]
        },
       {
            "name": "WebAccess",
            "essential": true,
            "parameters": ["http://localhost:8000"]
        }
    ]

 

Can a custom visual do an API call and hold the response in memory? does the 30,000 limit apply in that case?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.