cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Returning Images via the API using Path rather than ID

Hi

 

I have some image assets stored in a report server folder which work correctly in dashboards using the following api reference:

 

https://MyUrl/PBIReports/api/v2.0/Resources(c7ba28cc-60be-4a0c-a49a-c7b17b7d62d4)/Content/$value

 

However I need to be able to use these image assets in a dashboard by using the path method rather than the Id method.  According to the documentation I should be able to use this:

 

https://MyUrl/PBIReports/api/v2.0/Resources(path='/MyPath/Text-Blue.png')

 

Unfortunately this returns an error:

 

{
  "@odata.context":"https://MyUrl/PBIReports/api/v2.0/$metadata#Resources/$entity","Id":"c7ba28cc-60be-4a0c-a49a-c7b17b7d62d4","Name":"Text-Blue.png","Description":null,"Path":"/MyPath/Text-Blue.png","Type":"Resource","Hidden":false,"Size":2740,"ModifiedBy":"MyLogin","ModifiedDate":"2019-04-16T10:51:41.853+01:00","CreatedBy":"MyLogin","CreatedDate":"2019-04-16T10:51:41.853+01:00","ParentFolderId":"dd5509b6-8794-4d7e-97f7-b9781536b785","IsFavorite":false,"Roles":[
    
  ],"ContentType":"image/png","Content":""
}

 

The error message suggests that the syntax is correct as the Id in the error is the same one when I use the ID method but it isn't displaying the image.

 

Any ideas on what I'm missing?

Many thanks

 

PBIRS: Jan2020 | Desktop Jan 2020

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Returning Images via the API using Path rather than ID

This was a bug that was introduced recently. I was told by a contact at Microsoft that this had been fixed but I just double checked the recent May 2020 release and this is still happening. I looks like the GET against the /Resources works with path= to get the metadata, but when you add /Content/$value, then it breaks. 

 

I did just find one work around, you can use the WebService endpoint instead of the Portal's REST API and use a request like the following:

 

https://MyUrl/reportserver?/MyPath/Text-Blue.png&rs:Command=GetResourceContents

 

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Returning Images via the API using Path rather than ID

This was a bug that was introduced recently. I was told by a contact at Microsoft that this had been fixed but I just double checked the recent May 2020 release and this is still happening. I looks like the GET against the /Resources works with path= to get the metadata, but when you add /Content/$value, then it breaks. 

 

I did just find one work around, you can use the WebService endpoint instead of the Portal's REST API and use a request like the following:

 

https://MyUrl/reportserver?/MyPath/Text-Blue.png&rs:Command=GetResourceContents

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Returning Images via the API using Path rather than ID

Perfect Darren, the web service end point works.  

 

Shall I raise a bug?

 

Many thanks.

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Kudoed Authors