ibm-watsonwatson-text-to-speech

Test speech-to-text watson API with Postman, but get Error 401 on


I am very new to this kind of stuff. This is my setup. enter image description here

Any suggestion is appreciated.


Solution

  • Hi The issue is in Authorization, API key needs to be provided under Authorization tab, I would suggest to cross check API key via IBM console

    Here is steps to convert text to speech using IBM watson with postman

    1. I assume you have ApiKey value, If you do not have Go to, IBM watson, create text-to-speech resource, -> Go to Manage -> You will have the API Key IBM console
    2. Go to Postman, create new Post request
    3. Now you need to add URL, Authorization using Basic Method, Headers & data refer Authorization Header data/body

    Click on Send and you will receive audio under response -> Body tab

    If you want to do quick check then you can use curl for the same

     curl -X POST \
        https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize \
          -H 'Accept: audio/wav' \
          -H 'Authorization: Basic REPLACE_API_KEY' \
          -H 'Content-Type: application/json' \
          -H 'Postman-Token: 3c147726-2f1e-4531-abca-0898127e8644' \
          -H 'cache-control: no-cache' \
          -d '{"text": "hello world"}'