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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Testing License API

Hi
How can I test license API before publishing the bundle to AppSource?

I have React to build my own visul and use license API for payments.
I found examples here:
https://learn.microsoft.com/en-gb/power-bi/developer/visuals/licensing-api

How I can test it?

3 REPLIES 3
Anonymous
Not applicable

My code:

constructor(options: VisualConstructorOptions) {
this.host = options.host
this.licenseManager = options.host.licenseManager

this.licenseManager.getAvailableServicePlans().then((result) => {
this.isPowerBILicense = !!(
result.plans &&
result.plans.length &&
result.plans.some(
(plan) =>
PAID_PLANS.includes(plan.spIdentifier) &&
(plan.state === powerbi.ServicePlanState.Active ||
plan.state === powerbi.ServicePlanState.Warning),
)
)
})
}

Now, I am in developer mode and I can't get real data, because the visual is not published.
How can I test the license?

Anonymous
Not applicable

Thanks. I know how to work with Postman, but I want to know another thing.
I use licenseManager to get license data (plans, isLicenseUnsupportedEnv, isLicenseInfoAvailable) from powerBI to know if I have to show a watermark (watermark to buy a license).

Example:
options.host.licenseManager.getAvailableServicePlans().then((result: LicenseInfoResult) => { ... }


So, the question is “How I can test the license plans before publishing the app?”
How can I test instructions from this page? (https://learn.microsoft.com/en-gb/power-bi/developer/visuals/licensing-api)

I want to test cases if I have a plan with a license key or if I have a trial period or if I don’t have a license. How can I test these cases?

Anonymous
Not applicable

Hi @Anonymous ,

 

I think you can try to send API by third party tool Postman.

For reference:

https://learning.postman.com/docs/getting-started/sending-the-first-request/

https://hevodata.com/learn/postman-rest-client/

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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