Forum Discussion
CrouchingTiger
1 year agoHelper I
web data Json conversion error
Hi, experts What I want to do is schedule refresh of web Open API in Power BI. So, I refered many of articles to fix it. using relativepath and query. Code as below (NumOfRows as text...
- 1 year ago
Try these:
let // Parameters (can be replaced with dynamic inputs or function arguments) APIKey = "YourAPIKey", NumOfRows = "12", PageNo = "1", DataType = "JSON", Today = "20241204", // Example date; replace with dynamic logic if needed RecentBaseTime = "0800", // Example time; replace with dynamic logic if needed NX = "61", NY = "110", // Query Parameters as a Record QueryParameters = [ serviceKey = APIKey, numOfRows = NumOfRows, pageNo = PageNo, dataType = DataType, base_date = Today, base_time = RecentBaseTime, nx = NX, ny = NY ], // Build Query String QueryString = Uri.BuildQueryString(QueryParameters), // API Request Source = Json.Document(Web.Contents( "https://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst?", [Query = QueryParameters] )) in SourceQueryString = Uri.BuildQueryString(QueryParameters) will return serviceKey=YourAPIKey&numOfRows=12&pageNo=1&dataType=JSON&base_date=20241204&base_time=0800&nx=61&ny=110
let // Parameters (can be replaced with dynamic inputs or function arguments) APIKey = "YourAPIKey", NumOfRows = "12", PageNo = "1", DataType = "JSON", Today = "20241204", // Example date; replace with dynamic logic if needed RecentBaseTime = "0800", // Example time; replace with dynamic logic if needed NX = "61", NY = "110", // API Request Source = Json.Document(Web.Contents( "https://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/", [ RelativePath = "getVilageFcst?", Query = [ serviceKey = APIKey, numOfRows = NumOfRows, pageNo = PageNo, dataType = DataType, base_date = Today, base_time = RecentBaseTime, nx = NX, ny = NY ] ] )) in Source
CrouchingTiger
1 year agoHelper I
Thank you for your guide. I'll try it
And could you please let me know, how can I get the full string of Web.Contents("full string") in it
I think the full string shoud be as below
danextian
1 year agoSuper User
Try these:
let
// Parameters (can be replaced with dynamic inputs or function arguments)
APIKey = "YourAPIKey",
NumOfRows = "12",
PageNo = "1",
DataType = "JSON",
Today = "20241204", // Example date; replace with dynamic logic if needed
RecentBaseTime = "0800", // Example time; replace with dynamic logic if needed
NX = "61",
NY = "110",
// Query Parameters as a Record
QueryParameters = [
serviceKey = APIKey,
numOfRows = NumOfRows,
pageNo = PageNo,
dataType = DataType,
base_date = Today,
base_time = RecentBaseTime,
nx = NX,
ny = NY
],
// Build Query String
QueryString = Uri.BuildQueryString(QueryParameters),
// API Request
Source = Json.Document(Web.Contents(
"https://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst?",
[Query = QueryParameters]
))
in
Source
QueryString = Uri.BuildQueryString(QueryParameters) will return serviceKey=YourAPIKey&numOfRows=12&pageNo=1&dataType=JSON&base_date=20241204&base_time=0800&nx=61&ny=110
let
// Parameters (can be replaced with dynamic inputs or function arguments)
APIKey = "YourAPIKey",
NumOfRows = "12",
PageNo = "1",
DataType = "JSON",
Today = "20241204", // Example date; replace with dynamic logic if needed
RecentBaseTime = "0800", // Example time; replace with dynamic logic if needed
NX = "61",
NY = "110",
// API Request
Source = Json.Document(Web.Contents(
"https://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/",
[
RelativePath = "getVilageFcst?",
Query = [
serviceKey = APIKey,
numOfRows = NumOfRows,
pageNo = PageNo,
dataType = DataType,
base_date = Today,
base_time = RecentBaseTime,
nx = NX,
ny = NY
]
]
))
in
Source