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:
I've tried both several times, but it doesn't matter. I always get the error:
{
"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"
}
{
"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."
}
}
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492