You can send files and binary data directly to HPE IDOL Speech Server using a POST request. One possible way to send a POST request over a socket to HPE IDOL Speech Server is using the cURL command-line tool.
The data that you send in a POST request must adhere to specific formatting requirements. You can send only the following content types in a POST request to HPE IDOL Speech Server:
application/x-www-form-urlencoded
multipart/form-data
HPE IDOL Speech Server rejects POST requests larger than the size specified by the configuration parameter MaxFileUploadSize
.
The application/x-www-form-urlencoded
content type describes form data that is sent in a single block in the HTTP message body. Unlike the query part of the URL in a GET request, the length of the data is unrestricted. However, HPE IDOL Speech Server rejects requests that exceed the size specified by the configuration parameter MaxFileUploadSize
.
This content type is inefficient for sending large quantities of binary data or text containing non-ASCII characters, and does not allow you to upload files. For these purposes, HPE recommends sending data as multipart/form-data
(see Multipart/form-data).
In the request:
=
).,
).&
).In the multipart/form-data
content type, the HTTP message body is divided into parts, each containing a discrete section of data.
Each message part requires a header containing information about the data in the part. Each part can contain a different content type; for example, text/plain
, image/png
, image/gif
, or multipart/mixed
. If a parameter specifies multiple files, you must specify the multipart/mixed
content type in the part header.
Encoding is optional for each message part. The message part header must specify any encoding other than the default (7BIT).
Multipart/form-data is ideal for sending non-ASCII or binary data, and is the only content type that allows you to upload files. For more information about form data, see http://www.w3.org/TR/html401/interact/forms.html.
In cURL, you specify each message part using the -F
(or --form
) option. To upload a file in a message part, prefix the file name with the @
symbol. For more information on cURL syntax, see the cURL documentation.
Example
The following example sends audio.mp3
(using cURL) as multipart/form-data
to HPE IDOL Speech Server located on the localhost
, using port 13000. The example action runs the WavToText
task on the audio file.
curl http://localhost:13000/?action=AddTask –F Type=WavToText –F taskdata=@audio.mp3 –F Out=test.ctm
|