503 Response Error Code - Using Graph API For Indexing Data against Microsoft Search - sharepoint

I have no clue as to why this is happening for this API only. I am getting 503 service unavailable. Can someone please help me in this.
Payload Used:
{
"#odata.type": "microsoft.graph.externalItem",
"acl": [
{
"type": "user",
"value": "****Azure Object ID***",
"accessType": "grant",
"identitySource": "azureActiveDirectory"
},
{
"type": "user",
"value": "*****AZURE OBJECT ID******",
"accessType": "grant",
"identitySource": "azureActiveDirectory"
}
],
"properties": {
"Product": "Product created in manual",
"Company": "ITC Infotech",
"Category": "Mobile",
"Description" : "this is just a dummy description",
"Price": "$20.22",
"HomePage": "https://www.google.com",
"Image": "https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/gardenia-royalty-free-image-1580854928.jpg?crop=1xw:1xh;center,top&resize=480:*"
},
"content": {
"value": "this is just a dummy description",
"type": "text"
}
}

Looks like you need to add /external/connections. Please look at this document.

Related

No operations defined in spec! && Resolver error Cannot read properties of undefined (reading 'api')

I have this error in my node JS in swagger-ui-express I don`t know how to fix it
enter image description here
this is the code in the index.js file
in this code I`am tryin to call the json file that I make and call it swagger.json
const swaggerUi = require('swagger-ui-express'), swaggerDocument = require('./swagger.json')
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument))
that the pic of the beggin of the code
enter image description here
but I`am think that the error is here in this json file
"paths": {
"/api/category": {
"tages": [
"Category"
],
"summery": [
"Get all Categories"
],
"parameters": [
{
"name": "categoryName",
"in": "query",
"required": false,
"description": "Category name",
"type": "string"
},
{
"name": "page",
"in": "query",
"required": false,
"description": "Page Number",
"type": "integer",
"default": 1
},
{
"name": "PageSize",
"in": "query",
"required": false,
"type": "integer",
"default": 10
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ServiceResponse"
}
}
}
},
"post": {
"tages": [
"Category"
],
"summery": "Create Category API",
"parameters": [
{
"name": "categoryName",
"in": "formDate",
"descripition": "Category Name",
"required": true,
"type": "string"
},
{
"name": "CategoryDescription",
"in": "formDate",
"descripition": "Category Description",
"type": "string"
},
{
"name": "Category Image",
"in": "formDate",
"descripition": "Category Image",
"type": "file"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ServiceResponse"
}
}
}
}
},
There are some typos and syntax errors:
The "/api/category" path is missing the "get": node that would wrap the GET operation definition. It should look like this:
"paths": {
"/api/category": {
"get": {
"tags": ...
"tages" should be "tags".
"summery": [...] should be replaced with:
"summary": "Get all Categories",
"in": "formDate" should be "in": "formData" ("a" at the end).
"descripition" should be "description".
Paste your OpenAPI JSON into https://editor.swagger.io - it will show all errors.

Swagger OpenAPI describing string array in multipart request

I need to describe a multipart query that has an array of strings. But I ran into a problem, in the query, the array elements are combined into one string instead of being separate string items. I am using OpenApi 3.0.3
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["image"],
"properties": {
"image": {
"type": "string",
"format": "base64",
"description": "Banner image `1920x90, 2mb`"
},
"name": {
"type": "string",
"example": "Docs banner",
"description": "Banner name"
},
"link": {
"type": "string",
"description": "Banner link"
},
"page[]": {
"type": "array",
"items": {
"type": "string"
},
"example": ["HOME", "LIVE", "CHANNELS"],
"enum":[
"HOME",
"LIVE",
"CHANNELS",
"ARTISTS",
"DISCOVER",
"MYLIST",
"PROGRAM",
"PLAYER"
],
"description":"Banner pages"
}
}
}
}
What I received: page: [ 'HOME,LIVE,CHANNELS' ]
What I expect: page: [ 'HOME','LIVE','CHANNELS' ]
It's not very clear where exactly do you receive page: [ 'HOME,LIVE,CHANNELS' ], but looks like in enum there are possible values for items of your array. Try this:
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["image"],
"properties": {
"image": {
"type": "string",
"format": "base64",
"description": "Banner image `1920x90, 2mb`"
},
"name": {
"type": "string",
"example": "Docs banner",
"description": "Banner name"
},
"link": {
"type": "string",
"description": "Banner link"
},
"page[]": {
"type": "array",
"items": {
"type": "string",
"enum":[
"HOME",
"LIVE",
"CHANNELS",
"ARTISTS",
"DISCOVER",
"MYLIST",
"PROGRAM",
"PLAYER"
],
"example": "HOME"
},
"example": [ "HOME", "LIVE", "CHANNELS" ],
"description":"Banner pages"
}
}
}
}
You can look for more details at the specification for adding examples.
This structure allows you to send multiple string enum items for page element, screenshot from swagger editor is below:

Adaptive card in teams not workig - REST API

I created a bot (nodejs server) for teams - through bot framework.
I'm trying to send adaptive card that I created through: adaptive cards designer
and I get error :
{"code":"BadArgument","message":"ContentType of an attachment is not set"}
The request body :
{
"type": "message",
"from": {
"id": "xxxxxx"
},
"conversation": {
"id": "xxxxxx"
},
"recipient": {
"id": "xxxxx"
},
"replyToId": "xxxxx",
"text": "some text",
"attachments": [
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "some text"
},
{
"type": "Input.Date",
"separator": true
}
]
}
]
}
I would appreciate help
When adding attachments you'll want to set the contentType and content properties of the attachment object.
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#attachment-object
{
"type": "message",
"from": {
"id": "xxxxxx"
},
"conversation": {
"id": "xxxxxx"
},
"recipient": {
"id": "xxxxx"
},
"replyToId": "xxxxx",
"text": "some text",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "some text"
},
{
"type": "Input.Date",
"separator": true
}
]
}
}
]
}
As per the comments above, this is a pro-active message, but using the Bot Framework libraries are a much better approach than trying to call the bot endpoints directly (I wondered if, by "REST", you meant the Bot Framework endpoint or the Graph Api, but in either case the Bot Framework is easier to work with for proactive messages).
Please see specifically this sample for how to do this in Node.

Missing Subscription Key field in Swagger API connector (trough Azure API Management) in Logic App

I have created a REST API with a Swagger/OPEN API specification which I will like to consume trough a Azure API Management tenant in a Logic App.
When I download the specification it looks like this:
{
"swagger": "2.0",
"info": {
"title": "Leasing",
"version": "1.0"
},
"host": "ENDPOINT.azure-api.net",
"basePath": "/leasing",
"schemes": [
"http",
"https"
],
"securityDefinitions": {
"apiKeyHeader": {
"type": "apiKey",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
},
"apiKeyQuery": {
"type": "apiKey",
"name": "subscription-key",
"in": "query"
}
},
"security": [
{
"apiKeyHeader": []
},
{
"apiKeyQuery": []
}
],
"paths": {
"/{Brand}/groups": {
"get": {
"description": "Get a list of leasing groups on a brand",
"operationId": "GetGroups",
"parameters": [
{
"name": "Brand",
"in": "path",
"description": "Selection of possible brands",
"required": true,
"type": "string",
"enum": [
"Volkswagen",
"Audi",
"Seat",
"Skoda",
"VolkswagenErhverv",
"Porsche",
"Ducati"
]
}
],
"responses": {
"200": {
"description": "Returns a list of leasing groups",
"schema": {
"$ref": "#/definitions/GroupArray"
}
},
"400": {
"description": "If the brand is not valid",
"schema": {
"$ref": "#/definitions/Error"
}
}
},
"produces": [
"application/json"
]
}
}
},
"definitions": {
"Group": {
"type": "object",
"properties": {
"id": {
"format": "int32",
"type": "integer"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"leasingModelCount": {
"format": "int32",
"type": "integer"
},
"lowestMonthlyFee": {
"format": "int32",
"type": "integer"
}
}
},
"Error": {
"type": "object",
"properties": {
"code": {
"enum": [
"NotValidBrand",
"NotValidGroupId"
],
"type": "string",
"x-ms-enum": {
"name": "ErrorCode",
"modelAsString": true
}
},
"message": {
"type": "string"
}
}
},
"GroupArray": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
When I add this in a Logic App with the connector HTTP + Swagger I only get to define the {Brand} query input but not the various ways of using the Subscriptions key (header or query) as defined in SecurityDefiniations.
The whole securityDefinitions and security section are automatically generated in the Azure API Management service, but not recognized in Logic App.
See image of missing subscription key field:
What am I doing wrong?
Update
I have tried the following:
Usage of the 'Authentication' field (but this field is limited to certain types of auths flows https://learn.microsoft.com/en-us/azure/connectors/connectors-native-http#authentication)
Change the Logic App 'Http + Swagger'-action in code to add the header parameter, but this action converts the action to a simple 'Http' action and therfore loosing the automatic schema generation from Swagger.
I think you need to specify this in the Authentication-field in a JSON format. Something like:
{
"apiKeyHeader" : "your Ocp-Apim-Subscription-Key",
"apiKeyQuery" : "your subscription key"
}

Discovery Document for Google Email Migration API v2?

Today Google announced a new version of the Email Migration API. The API appears to follow Google's normal REST format but I've been unable to determine the service name and version information for the API in order to use it with the google-api-python-client.
Is there a discovery document for the new API and if so what is the service name and version?
The discovery document was slightly delayed from the actual release, but it's now available through the discovery service or directly here.
For now, I've been able to write my own non-standard discovery document. It's probably buggy/incomplete but it's working for me for test messages and the Python API Client.
{
"kind": "discovery#restDescription",
"etag": "\"BgGz67p-6wsAbOn4St98QhtBGbA/blODPd9XLaVQKZp7pexaIpilnaw\"",
"discoveryVersion": "v1",
"id": "emailmigration:v2",
"name": "emailmigration",
"version": "v2",
"revision": "20130717",
"title": "Email Migration API",
"description": "API to migrate messages to Google Apps Gmail Accounts",
"ownerDomain": "google.com",
"ownerName": "Google",
"documentationLink": "https://developers.google.com/admin-sdk/email-migration/",
"protocol": "rest",
"baseUrl": "https://www.googleapis.com/email/v2/",
"basePath": "/email/v2/users/",
"rootUrl": "https://www.googleapis.com/",
"servicePath": "email/v2/users/",
"batchPath": "batch",
"parameters": {
"alt": {
"type": "string",
"description": "Data format for the response.",
"default": "json",
"enum": [
"json"
],
"enumDescriptions": [
"Responses with Content-Type of application/json"
],
"location": "query"
},
"fields": {
"type": "string",
"description": "Selector specifying which fields to include in a partial response.",
"location": "query"
},
"key": {
"type": "string",
"description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
"location": "query"
},
"oauth_token": {
"type": "string",
"description": "OAuth 2.0 token for the current user.",
"location": "query"
},
"prettyPrint": {
"type": "boolean",
"description": "Returns response with indentations and line breaks.",
"default": "true",
"location": "query"
},
"quotaUser": {
"type": "string",
"description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
"location": "query"
},
"userIp": {
"type": "string",
"description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
"location": "query"
}
},
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/email.migration": {
"description": "Write access to Email Migration API v2."
}
}
}
},
"schemas": {
"Mail": {
"id": "Mail",
"type": "object",
"description": "The metadata for a mail message.",
"properties": {
"isDraft": {
"type": "boolean",
"description": "The message is marked as a draft when migrated to the Gmail mailbox."
},
"isInbox": {
"type": "boolean",
"description": "The message should appear in the Inbox, regardless of its labels. By default, a migrated mail message will appear in the Inbox only if it has no labels."
},
"isSent": {
"type": "boolean",
"description": "The message is marked as \"Sent Mail\" when migrated to the Gmail mailbox."
},
"isStarred": {
"type": "boolean",
"description": "The message is starred when migrated."
},
"isTrash": {
"type": "boolean",
"description": "The message is marked as \"Trash\" when migrated."
},
"isUnread": {
"type": "boolean",
"description": "The message is marked as unread when migrated. Without this property, a migrated mail message is marked as read."
},
"isDeleted": {
"type": "boolean",
"description": "The message is migrated directly into Google Vault. Once archived in Google Vault, the message is only visible to a Vault administrator."
},
"labels": {
"type": "array",
"description": "The labels applied to the message when migrated.",
"items": {
"type": "string"
}
}
}
}
},
"resources": {
"mail": {
"methods": {
"insert": {
"id": "emailmigration.mail.insert",
"path": "{userKey}/mail",
"httpMethod": "POST",
"description": "Insert a Mail resource into a user's Gmail account.",
"parameters": {
"userKey": {
"type": "string",
"description": "The email address or email alias of the user's mailbox to migrate the message to.",
"required": true,
"location": "path"
}
},
"request": {
"$ref": "Mail"
},
"scopes": [
"https://www.googleapis.com/auth/email.migration"
],
"supportsMediaUpload": true,
"mediaUpload": {
"accept": [
"message/rfc822"
],
"maxSize": "32MB",
"protocols": {
"simple": {
"multipart": true,
"path": "/upload/email/v2/users/{userKey}/mail"
},
"resumable": {
"multipart": true,
"path": "/upload/email/v2/users/{userKey}/mail"
}
}
}
}
}
}
}
}

Resources