Forum Discussion
markvanwyk
1 year agoRegular Visitor
Web API Issue in Power BI Desktop
Hi All I have an issue with the Power BI Web Advanced Query - I can get the API to authneticate and get data from most queries but the below query requires as SericeRequest and I do not know how ...
- 1 year ago
let url = "https://qualysapi.qualys.eu/qps/rest/2.0/search/am/hostasset", headers = [ #"Content-Type" = "text/xml", #"X-Requested-With" = "QualysPostman", #"Authorization" = "xxxxxxxxx" ], body = "<ServiceRequest> <filters> <Criteria field=""tagName"" operator=""EQUALS"">Cloud Agent</Criteria> </filters> </ServiceRequest>", Source = Web.Contents(url, [ Headers = headers, Content = Text.ToBinary(body) ]), Response = Xml.Tables(Source) in ResponseAlternatively you can use the recommended approach - Json.FromValue
markvanwyk
1 year agoRegular Visitor
Hi Ibendlin
I get the below error in PowerBI
DataSource.Error: Web.Contents failed to get contents from 'https://qualysapi.qualys.eu/qps/rest/2.0/search/am/hostasset' (400):
Details:
DataSourceKind=Web
DataSourcePath=https://qualysapi.qualys.eu/qps/rest/2.0/search/am/hostasset
Url=https://qualysapi.qualys.eu/qps/rest/2.0/search/am/hostasset
lbendlin
1 year agoSuper User
let
url = "https://qualysapi.qualys.eu/qps/rest/2.0/search/am/hostasset",
headers = [
#"Content-Type" = "text/xml",
#"X-Requested-With" = "QualysPostman",
#"Authorization" = "xxxxxxxxx"
],
body = "<ServiceRequest>
<filters>
<Criteria field=""tagName"" operator=""EQUALS"">Cloud Agent</Criteria>
</filters>
</ServiceRequest>",
Source = Web.Contents(url, [
Headers = headers,
Content = Text.ToBinary(body)
]),
Response = Xml.Tables(Source)
in
Response
Alternatively you can use the recommended approach - Json.FromValue