Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 49061

Re: Calling Azure ML Web Service from Power BI

$
0
0

My code to call the Cognitive Services API looks as follows:

(Source as table) as any =>
let
    JsonRecords = Text.FromBinary(Json.FromValue(Source)),
    JsonRequest = "{""documents"": " & JsonRecords & "}",

    JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Ascii),
    Response =
        Web.Contents("https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment?",
            [
                Headers = [#"Ocp-Apim-Subscription-Key"= "MY KEY",
                           #"Content-Type"="application/json", Accept="application/json"],
                Content=JsonContent 
            ]),
    JsonResponse = Json.Document(Response,1252)
in
    JsonResponse

Since the Azure ML web service gives a url and key, I figured it would be possible to call it similar to the call above.  However, the structure of the call and the required headers is a bit different, and trying to figure out the required pieces from the Azure ML web service API page is difficult.

 

Any thoughts?


Viewing all articles
Browse latest Browse all 49061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>