我将向Bing搜索API发送ajax请求。当我将请求放在浏览器中时,用于请求的URL可以工作。使用ajax,我得到了一个401错误"The authorization type you provided is not supported. Only Basic and OAuth are supported"
所以我的头是错的。它在浏览器中工作,因为我手动输入了我的azure帐户键。
<script>
$scope.bingsearch = function() {
var azurekey = '....vjrQ
我想使用UnityEngine.Networking和StartCoroutine()从Unity#中的必应API中检索数据。我得到了错误401,即:
{"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 region
我已经遵循了微软的指南,但我只是不断地得到一个错误的JSON (响应如下)。
下面是我的尝试,遵循微软的官方指南:
let https = require('https');
let bingSubscriptionKey = '[SUBSCRIPTIONKEY]'; // tried both keys I received on the Azure portal
let bingHost = 'api.bing.microsoft.com'; // this is the endpoint I was provided with on the
我正在API管理中创建一个新的API,使用
PUT
{“属性”:{ "contentFormat":"swagger-link-json","contentValue":"","path":"demoapi2",}}
PUT
(“免费”产品是不需要订阅的产品) GET works perfect
然后我尝试进行新的修订(以反映更新后的swaggerfile)属性{“”:{ "contentFormat":“swagger--json”,"contentValue"
请帮助找出以JSON格式返回结果的Bing搜索请求的参数。
文档“迁移Bing Search API应用程序”告诉我们:
To authenticate a Bing Search API request with Windows Azure Marketplace, you must obtain an account key. This mode of authentication replaces the AppID used in the Bing Search API 2.0.
另一方面,同一文档提供了仍然使用Appid的以下示例:
http://api.search.live.ne
我正在尝试使用的PyBingSearch模块来使用Bing API来返回搜索结果。在github页面中,他们有一个如何使用它的示例。
from py_bing_search import PyBingWebSearch
search_term = "Python Software Foundation"
bing_web = PyBingWebSearch('Your-Api-Key-Here', search_term, web_only=False) # web_only is optional, but should be true to use your
我刚刚注册了Azure免费试用版,并添加了Bing认知服务(我想做图像搜索)。我已经从服务的资源管理部分获得了服务的身份验证密钥,并按照文档中的演练步骤操作。下面是一个示例请求:
curl "https://api.cognitive.microsoft.com/bing/v7.0/images/search?safeSearch=Strict&q=Chutes%20and%20Ladders%20game&imageType=Photo" \ -H 'Ocp-Apim-Subscription-Key: <my key from Res
我试图使用在微软学术图表上运行一些查询。我不知道该为Ocp-Apim-Subscription-Key使用什么。(我见过,但没什么用。)当我尝试运行查询时,我得到以下消息(401:拒绝访问):Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.。这要么是在命令行上使用curl实现的:
curl -v -X GET "https://westus.api.cognitive
我使用ASP.NET Web API 2.3 (在NuGet中是5.2.3)作为RESTful应用程序接口。认证方式为不记名token (模板默认)。一切都是由模板默认生成的。
我使用的是MySQL数据库和ASP.NET Identity for MySQL的自定义实现(没有EF)。在创建了一些默认帐户后,帐户控制器被阻止。
生成令牌时,默认的有效期为14天。我上传到了Windows Server 2016数据中心版本。由于某些原因,当超过半小时或更长时间后,它会使用有效令牌拒绝API访问(401,请求被拒绝)。
这种行为的原因是什么?
我很难理解Oauth的验证。我正在尝试使用bing的搜索api。他们要求oauth核实。我有他们给我的主钥匙。我遇到的问题是如何提出请求,提供oauth验证密钥。
例如,如果我试图通过以下方法发出get请求:
http//api.datamarket.azure.com/Bing/Search?Query=%27xbox%27
我收到一个错误
The authorization type you provided is not supported. Only Basic and OAuth are supported
所以问题是,我是否将我的密钥嵌入到URL中,比如
http//api.da