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
prabhat_m
Frequent Visitor

Forming API Query from a table

Hi,

 

I'm trying to generate an API query which takes multiple webids as input from table values.

 

If I directly type the query as below I get the response:

prabhat_m_0-1666388856293.png

The Query works as below, passing each webid seperately.

prabhat_m_1-1666388966929.png

 

However, If I pass the webids from a table value (Custom Invoke using Json.Document(Web.Content("https:/apiserver.com/piwebapi/streamsets/value",[Query=[webid={ Column1}]])), the URL is getting passed with only webid as whole 

 

prabhat_m_2-1666389339391.png

 

prabhat_m_3-1666389466748.png

How to make this work so that all the value from the Coloumn can be passed in the query and it considers as seperate WebIds.

 

 

 

1 ACCEPTED SOLUTION

Hi @prabhat_m ,

Please update the code as below and check if it can work or not...

Json.Document(
  Web.Content(
    "https:/apiserver.com/piwebapi/streamsets/value", 
    [Query = [webid = Text.Split([Column1], ",")]]
  )
)

Any comment or problem, please feel free to let me know.

Best Regards

Community Support Team _ Rena
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

4 REPLIES 4
amitchandak
Super User
Super User

Thank Amit.

I'm using the same to form tables where cow from the example is webid.

I am trying to pass multiple query parameter for ex: Query=[q="cow","goat","dog"] which workis in the API that I'm using if I harcode it. It makes propoer query as api?q=cow&q=goat&q=dog and goes through.

 

However if I pass "Cow","goat","dog" from a coloum in a table, it is not working and the query becomes api?q="cow","goat","dog" which is incorrect format

Hi @prabhat_m ,

Please update the code as below and check if it can work or not...

Json.Document(
  Web.Content(
    "https:/apiserver.com/piwebapi/streamsets/value", 
    [Query = [webid = Text.Split([Column1], ",")]]
  )
)

Any comment or problem, please feel free to let me know.

Best Regards

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

Worked like a charm!! 
Thank you!

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.