cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlexisPREVOT
Helper III
Helper III

API with relative path

Hello,

I want to call an API that feeds me information following cells in a table using a relative path.

Here is my API call :

 

let
apiURL = "https://api.insee.fr/entreprises/sirene/V3/siret/",

options = [Headers=[Authorization="Bearer XXXXXXXX", ConsumerKey="XXXXXXXXXX", ConsumerSecret="XXXXXX", Accept="application/json"], RelativePath = #"ENTREPRISES"[SIRET]],

resultat = Json.Document(Web.Contents(apiURL,options))

in
resultat

 

I wish to have a final URL as well : https://api.insee.fr/entreprises/sirene/V3/siret/{"ENTREPRISES"[SIRET]}

 

My concern is that when I want to launch the call I have the following error message: 

 

Expression.Error : Sorry ... We were unable to convert a value of type List to type Text.
Détails :
Value=[List]
Type=[Type]

 

How can I solve this problem please ?

 

Thanks in advance

 

Alexis

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @AlexisPREVOT ,

In your RelativePath value, #"ENTREPRISES"[SIRET] returns a whole list not a specific text value so it occurs the convert error.

If you want to quote a specific text value from the list to use it as RelativePath, you can write like this:

#"ENTREPRISES"[SIRET]{0}   // 0 means that it extracts the first value in this list and so on

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Hi @AlexisPREVOT ,

In your RelativePath value, #"ENTREPRISES"[SIRET] returns a whole list not a specific text value so it occurs the convert error.

If you want to quote a specific text value from the list to use it as RelativePath, you can write like this:

#"ENTREPRISES"[SIRET]{0}   // 0 means that it extracts the first value in this list and so on

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Hi @v-yingjl,

 

Thank you for the answeer, it works.

 

Best regards

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors