curl no url指定//文本到语音IBM Bluemix

问题描述 投票:0回答:2

我开始使用卷曲的文本到语音,我遇到了麻烦。我用我的凭据从命令行中的exemple复制代码,但是有一个我无法解决的错误:curl:没有指定URL!

这是我尝试的代码:

curl -X POST -u {username}:{password} \
--header "Content-Type: application/json" \
--header "Accept: audio/wav" \
--data "{\"text\":\"hello world\"}" \
--output hello_world.wav \
"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize"

这里是命令行中的代码(win10):

Curl in command line no url specified

我可以帮忙吗? :)

curl command-line ibm-cloud
2个回答
1
投票

在Windows提示符中,由于报价中的引用而令人望而生畏。我尝试了这个并且工作:

  1. IBM网站/云中的原始帖子有两个版本,

--data'{“text”:“hello world”}',另一个是--data“{\”text \“:\”hello world \“}'

(即如果你在双引号中只使用双引号,你必须使用\,并且之后也没有空格:)

  1. 如果你使用第二种方式,你不能在冒号后有空格:所以最好总是删除空间以确保安全。
  2. 以下两项工作:

-X POST -u“apikey:xxxxxxxxxxxxxxxxxxxxx”--header“Content-Type:application / json”--header“Accept:audio / wav”--data'{“text”:“hello world”}' - output hello_world.wav“https://stream.watsonplatform.net/api/text-to-speech/api/v1/synthesize

C:\ Users \ rpo \ IBM-Watson> curl -X POST -u“apikey:xxxxxxxxxxxxxxxxxx”--header“Content-Type:application / json”--header“Accept:audio / wav”--data“{\ “text \”:\“hello world \”}“ - output”hello_world.wav“https://stream.watsonplatform.net/api/text-to-speech/api/v1/synthesize

  1. 似乎没有必要引用http字符串......

0
投票

您在(不必要的引用)URL和--output开关的值之间没留下空格。

© www.soinside.com 2019 - 2024. All rights reserved.