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
JOAOLBMARTINS
Helper II
Helper II

GOALS Rest API - Expanding on Values & Notes via PowerShell

Hey Community, 

 

Hope everybody is doing well.

 

I'm trying to develop a PowerShell script to colect not only Goals but its values and notes in one single line of code (without the need to loop over the Goals collection).

Following the documention, it seems that we have the possibility to "expand" the notes when we're selecting the GoalsValues:

 

JOAOLBMARTINS_0-1652981816781.png

 

I've already tried this one and it works only for expanding the goals values:

myURL = 

 
I'm trying the two scenarios below:
 
First one that is not working is to fetch goals values and notes at once using the following URL:
$myURL="https://api.powerbi.com/v1.0/myOrg/groups/$workspaceId/scorecards($scorecardId)?`$expand=goals(`$expand=goalValues(`$expand=notes))"
 
The second option, is to expand over goalValues only:
This one works, but the "notes" field returns empty/blank (or maybe I'm not knowing how to access it).
 
My last option and the only that works is the following:
$myURL="https://api.powerbi.com/v1.0/myOrg/groups/$workspaceId/scorecards($scorecardId)/goals($goalId)/goalValues(2022-05-14T00:00:00Z)?`$expand=notes"
However, to be able to get the note, I not only need to pass a GoalID but also the timestamp I want to retrieve the note.
 
Does anyone already played with the REST API for Goals and can give a way to access all the goals, values and notes at once?
 
Cheers,
 
João Martins

 

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @JOAOLBMARTINS,

I check the document but did not find any existed API that allows for bulk operation with multiple goals.
So I think you need to write a loop to invoke the single request multiple times with different parameters.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Ohh that's a shame. I really didn't want to loop over all the notes in all the goals to copy from one to another scorecard

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.