【发布时间】:2015-04-02 00:32:43
【问题描述】:
我正在尝试使用 Yoda speak api。这是我的小提琴:
-
http://jsfiddle.net/Dansker/tdhnmmye/
$.ajax({ url: 'https://yoda.p.mashape.com/yoda', // The URL to the API. You can get this by clicking on "Show CURL example" from an API profile type: 'GET', // The HTTP Method data: {sentence: $("#boxArea").val()}, // Additional parameters here datatype: 'json', success: function (data) { alert(data); }, error: function (err) { alert(err); }, beforeSend: function (xhr) { xhr.setRequestHeader("X-Mashape-Authorization", "<RvyROurVRvmshRzDcAtXABdytvkDp1MtroWjsnXo8Dcs9Dq6SB>"); // Enter here your Mashape key } });});});
我认为代码一切正常,但我不断收到 403 错误,说我的密钥不起作用。我一直在重置我的密钥,但它一直说它不起作用。是钥匙还是别的什么? “yoda speak”也会显示为警报吗?
【问题讨论】:
-
从您的密钥中删除 运算符。还假设这是您的实际 mashape 密钥,您不想将其发布在这里供所有人查看。附带说明一下,我使用上述 API 已经有一段时间了。结合 Mashape 问题和实际的 API 端点停机时间,我遇到了重大问题,因此切换到 funtranslations.com/api/yoda,它的工作就像一个魅力。