How to fix this error and what does this error mean in IBM Cloud? - ibm-cloud

Now I would like to use "Speech to Text" on IBM Cloud to get Japanese text from Speech data, mp3.
However, I have gotten the same error as below after I tried it many times.
<HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Write</H1>
The server encountered an internal error or
misconfiguration and was unable to
complete your request.
And this is my code with curl.
curl -X POST -u "apikey:{apikey}" \
--header "Content-Type: audio/mp3" \
--data-binary #{path_to_file} \
"https://gateway-tok.watsonplatform.net/speech-t
o-text/api/v1/recognize?model=jaJP_BroadbandModel"

You have a typo in the model, it should be ja-JP_BroadbandModel

Try this code
Note that: After the {url} , you must type /v1/recognize
*audio-file.flac is the name of the audio file
curl -X POST -u "apikey:{apikey}" ^
--header "Content-Type: audio/flac" ^
--data-binary #{audio file path}audio-file.flac ^
"{url}/v1/recognize"
Happy coding :)

Related

IBM Watson Text-to-Speech issue with German umlaute (ä-ö-ü)

I have a porblem when I want to export a .wav file.
With the English language i don't have any issues also when i want to export a German sentence without any Umlaute it works fine. But when i want to export something like "Häuschen" I can't open the file and it's also only 1KB big. Do you guys know what could be the problem?
I used the following code on WIN10
curl -X POST -u "apikey:{key}" ^
--header "Content-Type: application/json" ^
--header "Accept: audio/wav" ^
--data "{\"text\":\"Häuschen\"}" ^
--output Haeuschen.wav ^
"{url}/v1/voices/de-DE_ErikaV3Voice/synthesize"
I have tried to reproduce this on MacOs ... I had to replace the ^ with \ to have the correct multi line syntax, but other than that no change to your command.
curl -X POST -u "apikey:{key}" \
--header "Content-Type: application/json" \
--header "Accept: audio/wav" \
--data "{\"text\":\"Häuschen\"}" \
--output Haeuschen.wav \
"{url}/v1/voices/de-DE_ErikaV3Voice/synthesize"
The service returned a playable file that was 45KB big. So even this is not a solution for your problem, this gives you a data point that it should work and you can search for the right way to send this from a Windows machine now.

MarkLogic ingest JSON from external API

I am using Marklogic 9 and try to ingest data from external source into MarkLogic. I made an REST API on port 8031. When I try to execute the following curl command:
curl --anyauth --user admin:admin -i -X POST -d https://services7.arcgis.com/21GdwfcLrnTpiju8/arcgis/rest/services/Geluidsbelasting/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=json
-H "Content-type: application/json" -H "Accept: application/json" \
'http://localhost:8031
After executing this statement I receive the error:
Curl: URL is not specified
Can you please help me out!
Many thanks
Erik
Your -d parameter has special characters that are not escaped. Try putting quotes around your -d url. It will prevent your command from getting truncated and misinterpreted at & signs..
HTH!

curl no URL specified using POST

From a shell, I'm trying to use the REST API for Fedora Commons to upload a binary to a particular location using curl:
curl -X PUT --upload-file image.jpg -H "Content-Type: image/jpeg" -H "http://localhost:8080/rest/TestUpload/newexcel"
The error I'm getting:
curl: no URL specified!
Following instructions from here:
https://wiki.duraspace.org/display/FEDORA471/RESTful+HTTP+API
-H is for extra header to include in the request when sending HTTP to a server and you should not use it before the url.
You probably need to do curl -X PUT --upload-file image.jpg -H "Content-Type: image/jpeg" http://localhost:8080/rest/TestUpload/newexcel

Mashape multipart-form POST request

I have a POST method in my API which uses multipart encoded form data. I have set up the correct header and data settings so that the mashape web interface generated the following curl:
curl -X POST --include 'https://sslavov-text-analytics-v1.p.mashape.com/news' \
-H 'Authorization: Basic ***********' \
-H 'X-Mashape-Key: ************' \
-H 'Content-Type: multipart/form-data' \
-F 'file=#sample.docx' \
-F 'meta={"documentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"};type=application/json'
Basically i'm trying to upload a file with a simple paragraph of text for processing. The curious part is that when I run this exact curl in a bash script, everything works smoothly, but when I try to run it through mashape, it says either 400 Bad Request or 500 Internal Server Error
In my particular case, these errors are generated when I don't pass correct form or headers. So my question is: Is there an error in the curl syntax or should I keep looking for the error on server side?
EDIT: I figured out what the problem was. -F 'file=#sample.docx' was passed before -F 'meta....' and that was causing the 500 Internal Server Error So now the question is: Is there any way to specifically arrange the order of the form fields (because mashape rearranges them aplhabetically)?

Bad request when i try to lock file with Box api (curl method)

I try to lock a file via the API BOX but I encounted issue.
I use the code provided the api documenation (https://developers.box.com/docs/ Lock and Unlock section) but the code does not work.
curl https://api.box.com/2.0/files/xxxxxx\
> -H "Authorization: Bearer xxxxxx" \
> -d "lock": null \
> -X PUT
and the return of the API:
{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"entity-body","message":"Invalid value 'lock:'. Entity body should be a correctly nested resource attribute name\/value pair"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Bad Request","request_id":"xxxxxxxxx"}curl: (6) Couldn't resolve host 'null'
I did the test by trying to locke a file : same problem.
Several questions:
Is that the lock function has already work? Do you know if box has
changed its code ?
Any help is welcome :)
Nicolas
I had an answer by Suppor team :
There was a typo in the docs. Please try the command again:
Lock:
curl https://api.box.com/2.0/files/FILE_ID
-H "Authorization: Bearer ACCESS_TOKEN"
-d '{"lock": {"type": "lock","expires_at": "2015-12-12T10:55:30-08:00","is_download_prevented": false}}'
-X PUT
Unlock:
curl https://api.box.com/2.0/files/FILE_ID
-H "Authorization: Bearer ACCESS_TOKEN"
-d '{"lock": null}'
-X PUT
https://support.box.com/hc/fr/requests/793456?flash_digest=c5350d2f104f3066b46cb83baa97c23dac863d2b