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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
PoojaG
Helper II
Helper II

Azure Content Moderator API call from Power BI

I'm trying to call an API Azure Content Moderator from Power BI. I have one column in a table which needs to be moderated. I have below information about the API. 

 

 

POST https://abz.cognitiveservices.azure.com/contentmoderator/moderate/v1.0/ProcessText/Screen/?language=eng&autocorrect=true&PII=true&classify=true200
974 ms
POST /contentmoderator/moderate/v1.0/ProcessText/Screen/?language=eng&autocorrect=true&PII=true&classify=true HTTP/1.1
Ocp-Apim-Subscription-Key: <confidential>
Content-Type: text/plain
User-Agent: PostmanRuntime/7.28.3
Accept: */*
Postman-Token: b41cc134-a107-45cd-8996-68b12356
Host: abz.cognitiveservices.azure.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 17

 

  and the power query looks like below:

 

let
    Source = (text) => let
    apikey      = "b9confidential",
    endpoint    = "https://abz.cognitiveservices.azure.com/contentmoderator/moderate/v1.0/ProcessText",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "{ documents: [ { language: ""eng"", id: ""0"", text: " & jsontext & ",Content-Type: ""text/plain"" } ] }",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody]),
    jsonresp    = Json.Document(bytesresp),
    moderator  = jsonresp[documents]{0}[moderator]
in  moderator
in
    Source

 

I get an error when trying to invoke through custom function. Error says '404 Resource not found'. Can someone please help me correct the mquery? thank you

1 REPLY 1
v-yingjl
Community Support
Community Support

Hi @PoojaG ,

You may refer simliar issues:

  1. How to fix error “404” in Power BI M query 
  2. THE HIDDEN GEMS OF THE FUNCTION WEB.CONTENTS() 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors