web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trying to follow the t...
Power Automate
Unanswered

Trying to follow the tutorial to create a basic custom connector

(0) ShareShare
ReportReport
Posted on by 2,295

I'm just trying to follow the tutorial to learn how to create a custom connector here.

 

This is my Swagger code for the custom connector, after completing the tutorial and validating the connector:

 

 

 

swagger: '2.0'
info:
 title: SentimentDemo
 description: Demo sentiment analytics da API Azure cognitive services
 version: '1.0'
host: westus.api.cognitive.microsoft.com
basePath: /
schemes:
 - https
consumes: []
produces: []
paths:
 /text/analytics/v2.0/sentiment:
 post:
 responses:
 default:
 description: default
 schema:
 type: object
 properties:
 documents:
 type: array
 items:
 type: object
 properties:
 score:
 type: integer
 format: int32
 description: score
 id:
 type: string
 description: id
 description: documents
 errors:
 type: array
 items:
 type: object
 properties:
 id:
 type: string
 description: id
 message:
 type: string
 description: message
 description: errors
 summary: Returns a numeric score representing the sentiment detected
 description: >-
 The API returns a numeric score between 0 and 1. Scores close to 1
 indicate positive sentiment, while scores close to 0 indicate negative
 sentiment.
 operationId: DetectSentiment
 parameters:
 - name: body
 in: body
 required: false
 schema:
 type: object
 properties:
 documents:
 type: array
 items:
 type: object
 properties:
 language:
 type: string
 description: The 2 or 4 character language code for the text
 title: Language
 default: en
 id:
 type: string
 description: An identifier for each document that you submit
 title: ID
 format: ''
 text:
 type: string
 description: The text to analyze for sentiment
 title: Text
 default: None
 required:
 - id
 - language
 - text
 description: documents
 required:
 - documents
definitions: {}
parameters: {}
responses: {}
securityDefinitions:
 API Key:
 type: apiKey
 in: header
 name: Ocp-Apim-Subscription-Key
security:
 - API Key: []
tags: []

 

 

 

Everything is fine, but it doesn't work, when it comes to testing it.

 

These are the API keys I got from Azure:

 

WebPortal_0-1676031030423.png

 

 

I've tried both several times, but it doesn't matter. I always get the error:

 

Status
Unauthorized (401)
Headers
 

 

{
 "apim-request-id": "d68202be-664d-44c4-87c7-663acd8d5f89",
 "content-length": "224",
 "content-type": "application/json",
 "date": "Fri, 10 Feb 2023 12:07:13 GMT",
 "x-ms-apihub-cached-response": "true",
 "x-ms-apihub-obo": "false"
}

 

 
Body
 
 

 

{
 "error": {
 "code": "401",
 "message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."
 }
}

 

 

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @WebPortal 

     

    In the headers pass:

     

    "Ocp-Apim-Subscription-Key": "Your Key"

  • WebPortal Profile Picture
    2,295 on at

    @Sundeep_Malik 

     

    Sorry, Where should I write the key?

     

    WebPortal_0-1676039860682.png

     

     

    Or here somewhere?

    WebPortal_1-1676039886061.png

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard