cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericOnline Member
Member

Re: Passing Variables in API Post Request JSON Body

Hm. The response returns in a single column at the end of the Source table when using the syntax you provided, thank you very much.

I'm now trying to substitute some of the values from the Source table into the API call itself.

 

Example: From the full API call, I'm attempting to substitute the longitude from the table into the API call:

 

 

content = "{
        ""geocode"": {
                    ""lon"": " & _[value1] & ",
                    ""lat"": 46.4498901367188

Where "value1" is a longitude value of type Decimal Number from the Source table itself. I'm assuming the " " above turn the value1 into a string. I've tried _[value1] alone as well. Both attempts result in a Status 400 Error from the API.

 

I'm wondering if moving the Table.AddColumn() to the end of the query is affecting this ability. 


What are your thoughts @ImkeF

 

 

Highlighted
Super User
Super User

Re: Passing Variables in API Post Request JSON Body

No, conversion to string is not done automatically. Instead you have to write it like so:

 

content = "{
        ""geocode"": {
                    ""lon"": " & Text.From(_[value1]) & ",
                    ""lat"": 46.4498901367188

 

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries