Forum Discussion
Enterprise Gateway and Text Analytics
Assuming that you are referring to the Text Analytics API in the Azure Data Marketplace, in looking at this article:
https://azure.microsoft.com/en-us/documentation/articles/machine-learning-apps-text-analytics/
I would think that what you need to do is implement this in "M" code. Is that what you are doing?
We implemented the API in a Blank Query using the following code
(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"= "Our API key",
#"Content-Type"="application/json", Accept="application/json"],
Content=JsonContent
]),
JsonResponse = Json.Document(Response,1252)
in
JsonResponse
We then call the Query from a table that contains the text we want to analyze. The text comes from our on-premise SQL server that we connect to through the Enterprise data gateway. When we try to enable refresh on the dataset we get the following error.
Please try again later or contact support. If you contact support, please provide these details.