Forum Discussion
Assistance with Power Query – Missing ‘Closed’ Status in Data Extract
- 9 months ago
Hi PhilipTreacy
I found the correct one, I was missing {}filter = {"moduleName:Incident Reporting", "archivedStep:true", "form:2"}Thanks for all your guidance
HI ashmitp869
Are you sure that is the correct query parameter convention? Is that what the API documentation says?
It is unusual to have multiple parameters with the same name (filter). Certainly if you are calling a PHP script then this is bad and won't work as only the last filter parameter value is saved. But it will dependon what is receiving the request and how it is processed.
I would expect to use filter1, filter2 etc instead
If that really is the convention for this API try this
queryParams = [
sort = "creationDate",
asc = "false",
mobileOnly = "false",
filter = "moduleName:Incident Reporting&filter=form:2D&filter=archivedStep:true",
rowStart = Text.From(offset),
rowLimit = Text.From(pageSize)
]
Have you tried using postman to confirm the query format and the returned data?
Download Postman | Get Started for Free
Phil
- ashmitp8699 months ago
Responsive Resident
I have tried Insomnia
I am getting the result.
I have usedetPage = (offset as number) => let response = Json.Document(Web.Contents( "https://api.myosh.com", // Static base URL [ RelativePath = "v3/inf/records", Query = [ rowLimit = "1000", sort = "creationDate", asc = "false", mobileOnly = "false", // filter = "moduleName:Incident Reporting", filter ="moduleName:Incident Reporting&filter=form:2&archivedStep:true", //filter2 = "form:2", //filter3 = "archivedStep:true", // filter4 = "deleted:false", offset = Number.ToText(offset) ], Headers = [ #"x-api-key" = apiKey, #"Authorization" = authHeader, #"Accept" = "application/json" ] ] )), results = try response[results] otherwise {} in results, but not getting the result as expected.
I have tried to use direct Url, it is extracting all data in PBI desktop.
When publish to PBI server - I am getting error"This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. "
baseUrl = "https://api.myosh.com/v3/inf/records?rowLimit=1000&sort=creationDate&asc=false&mobileOnly=false&filter=moduleName:Incident Reporting&filter=form:2&filter=archivedStep:true&filter=deleted:false", // Function to get a page GetPage = (offset as number) => let url = baseUrl & "&offset=" & Number.ToText(offset), response = Json.Document(Web.Contents(url, [Headers = [ #"x-api-key" = apiKey, #"Authorization" = authHeader, #"Accept" = "application/json" ]] )), results = try response[results] otherwise {} in results- PhilipTreacy9 months ago
Super User
PBI Service requires that the data source (your baseUrl) be static - that is, PBI Service doesn't like the query parameters in the URL.
Try this
baseUrl = "https://api.myosh.com/v3/inf/records", GetPage = (offset as number) => let response = Json.Document( Web.Contents( baseUrl, [ RelativePath = "", Query = [ rowLimit = "1000&sort=creationDate&asc=false&mobileOnly=false&filter=moduleName:Incident Reporting&filter=form:2&filter=archivedStep:true&filter=deleted:false", offset = Number.ToText(offset) ], Headers = [ #"x-api-key" = apiKey, #"Authorization" = authHeader, #"Accept" = "application/json" ] ] ) ), results = try response[results] otherwise {} in resultsRegards
Phil
- PhilipTreacy9 months ago
Super User
Also, try this - note that syntax around the filter parameters
baseUrl = "https://api.myosh.com/v3/inf/records", GetPage = (offset as number) => let response = Json.Document( Web.Contents( baseUrl, [ RelativePath = "", Query = [ rowLimit = "1000", sort = "creationDate", asc = "false", mobileOnly = "false", #"filter" = "moduleName:Incident Reporting", #"filter" = "form:2", #"filter" = "archivedStep:true", #"filter" = "deleted:false", offset = Number.ToText(offset) ], Headers = [ #"x-api-key" = apiKey, #"Authorization" = authHeader, #"Accept" = "application/json" ] ] ) ), results = try response[results] otherwise {} in resultsPhil
- v-dineshya9 months ago
Community Support
Hi ashmitp869 ,
Could you please try the proposed solutions shared by PhilipTreacy ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.
Regards,
Dinesh