【发布时间】:2020-04-26 10:48:04
【问题描述】:
由于 Azure 门户中的 bug,我需要使用 REST API 以编程方式创建 Azure 认知搜索数据源、索引和索引器。创建数据源或索引没有问题,但下面的 POST 请求返回以下错误。
{
"error": {
"code": "",
"message": "The request is invalid. Details: dataSource : A resource without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\r\n"
}
}
以下 POST 请求是在此 page 上找到的修改示例,其中变量替换为服务名称、管理密钥、数据源名称和目标索引名称的正确名称。
POST 请求(使用邮递员)
POST https://SERVICENAME.search.windows.net/indexers?api-version=2019-05-06
Content-Type: application/json
api-key: ADMINKEY
{
"name" : "my-json-indexer",
"dataSourceName" : "BLOBDATASOURCE",
"targetIndexName" : "TARGETINDEX",
"schedule" : { "interval" : "PT2H" },
"parameters" : { "configuration" : { "parsingMode" : "json" } }
}
【问题讨论】: