Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
runski
Frequent Visitor

Enterprise Gateway and Text Analytics

Hi.

Can someone guide me on how to set up a connection to Text Analytics API using the Enterprise Gateway?

Thanks.

5 REPLIES 5
v-caliao-msft
Employee
Employee

Hi @runski,

 

As Smoupre said, do you use API on the link below?

https://azure.microsoft.com/en-us/documentation/articles/cognitive-services-text-analytics-quick-sta...

 

Please provide us more details about what you have done, so that we can make further analysis.

 

Regards,

Charlie Liao

 

Hi @v-caliao-msft@Greg_Deckler,

 

 

 

I work together with @runski. My post above explains our implementation approach and the error message the we see when we try to refresh our data using the Enterprise Gateway.

 

We do use the API from Microsoft Azure in the link provided by @v-caliao-msft.

 

We followed the method outlined in these blog posts. The only difference is that the text we analyse come from our on-premise SQL server instead of from Facebook.

 

http://community.powerbi.com/t5/Community-Blog/Sentiment-Analysis-in-Power-BI/ba-p/55898

http://datachant.com/2016/08/09/sentiment-analysis-power-bi-part-2/

 

 

Yesterday, we tried connecting to the .pibx file stored in OneDrive as opposed to publishing it to the Power BI Service. We were not able to refresh the data using this approach either.

 

 

Regards,

Ivar

I'm getting this as well it's very frustrating, has anyone found a work around or a fix yet?

 

{ "statusCode": 404, "message": "Resource not found" } when using the URL

https://westus.api.cognitive.microsoft.com/text/analytics/v2.0

Greg_Deckler
Super User
Super User

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?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

 

Something went wrong.
 
Failed to use the selected gateway. Please make sure the gateway is up and running and try again.
Please try again later or contact support. If you contact support, please provide these details.
Activity ID84912326-5530-51de-9f1b-04c74b35d761
Request IDf3a597ca-2144-5f1c-9b80-623075143a83
Correlation ID1422aa44-c7bc-1602-688c-872d0c2b6f0a
Status code400
TimeMon Oct 17 2016 10:52:42 GMT+0200 (Central European Daylight Time)
Version13.0.1700.374
 
If we delete the table that calls the query and republish the model refresh works fine. Any input on where we might be going wrong would be greatly appreciated!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.