更新 watsonplatform.net 端点以进行情绪分析,得到 404
Update watsonplatform.net endpoint for sentiment analysis, getting 404
我根据 IBM 的电子邮件说明(服务凭证 URL 和 api)更新了 Watson 端点,当我执行调用时,我收到“404 Not Found”。
Url 是
https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b
编辑:
这是我正在做的测试(以及我用于在实时环境中分析文本的相同代码):
function Analyse($text)
{
$body = '{
"text": "' . addslashes($text) . '",
"features": {
"sentiment": {}
}
}';
$url = "https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b";
$key = "ukLuEL.........qinV";
$response = Request::post($url)
->authenticateWith('apikey', $key)// authenticate with basic auth...
->body($body)
->sendsJson()
->send();
$body = $response->body; // <<<<< THIS MESSAGE STATES "NOT FOUND 404"
$sentiment = $body->sentiment->document;
return [
"label" => $sentiment->label,
"score" => $sentiment->score
];
}
如果我替换回旧凭据,它会起作用并且 returns 情绪。旧的 URL 是:
https://gateway-lon.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-03-19
确保不要只用基本 URI 替换旧的完整路径。请参阅 API docs for IBM Watson Natural Language Understanding 了解基本 URI 和各个 API 函数的路径。
因此,这个 URI:
https://gateway-lon.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-03-19
应该变成
https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b//v1/analyze?version=2021-03-25
我根据 IBM 的电子邮件说明(服务凭证 URL 和 api)更新了 Watson 端点,当我执行调用时,我收到“404 Not Found”。
Url 是
https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b
编辑: 这是我正在做的测试(以及我用于在实时环境中分析文本的相同代码):
function Analyse($text)
{
$body = '{
"text": "' . addslashes($text) . '",
"features": {
"sentiment": {}
}
}';
$url = "https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b";
$key = "ukLuEL.........qinV";
$response = Request::post($url)
->authenticateWith('apikey', $key)// authenticate with basic auth...
->body($body)
->sendsJson()
->send();
$body = $response->body; // <<<<< THIS MESSAGE STATES "NOT FOUND 404"
$sentiment = $body->sentiment->document;
return [
"label" => $sentiment->label,
"score" => $sentiment->score
];
}
如果我替换回旧凭据,它会起作用并且 returns 情绪。旧的 URL 是:
https://gateway-lon.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-03-19
确保不要只用基本 URI 替换旧的完整路径。请参阅 API docs for IBM Watson Natural Language Understanding 了解基本 URI 和各个 API 函数的路径。
因此,这个 URI:
https://gateway-lon.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-03-19
应该变成
https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com/instances/2xxxxx43-52ac-4xx5-922d-cxxxxx5ea52b//v1/analyze?version=2021-03-25