我必须在这里缺少一些非常简单的东西。我正在关注Example Tutorial Instructions。我已经创建了一个免费帐户,并且拥有我的API密钥和URL。我按照指示复制了JSON文件。这是我发出的命令:
curl -X POST -u "apikey:MY-API-KEY" \
--header "Content-Type: application/json" \
--data-binary PATH-TO-FILE \
"MY-URL"
这是我得到的错误:
{“代码”:400,“ sub_code”:“ C00012”,“错误”:“第1行第2列的JSON输入无效”}
我完全从以下方向复制了JSON:
{
"text": "Team, I know that times are tough! Product sales have been disappointing for the past three quarters. We have a competitive product, but we need to do a better job of selling it!"
}
我也尝试了以下JSON,并且收到了相同的错误:
{"text":"Hello world"}
我在这里想念什么明显的东西?
我知道那会很傻。
方向以这个为例:
curl -X POST -u "apikey:{apikey}" \
--header "Content-Type: application/json" \
--data-binary @{path_to_file}tone.json \
"{url}/v3/tone?version=2017-09-21"
对于文件的路径,我必须将@
符号放在前面。因此,假设文件的完整路径为/home/joe/Desktop/tone.json
,则该行必须为:
--data-binary @/home/joe/Desktop/tone.json \