Forum Discussion
saikishore
8 years agoNew Member
Passing Variables in API Post Request JSON Body
I'm using the google business API to get the driving directions insights (auth as text, locid as text) =>
let
AuthKey = "Bearer "& auth,
url = "https://mybusiness.googleapis.com/v3/accounts/...
- 8 years ago
Hi saikishore,
you don't use the parameter "locid" as text in your function at all. If your expression in step "body" is supposed to do this: It will not work. If locid is a single text string, you have to concatenate it like so:
"{""locationNames"":"& locid &",#(lf)""drivingDirectionsRequest"": {""numDays"":""NINETY"",},}"
v-yuta-msft
Community Support
8 years agoHi saikishore,
There may be something wrong the types of parameter you have predefined. Please check if type in power query matches type in JSON. The types of variables in M are like below:
{ any; none; null; logical; number; time; date; datetime; datetimezone; duration; text; binary; type; list; record; table; function; anynonnull }
For example, you can change type of locid with number and try again.
Best Regards,
Jimmy Tao