Send Data by Using a POST Method
You can send files and binary data directly to Eduction using a POST request. One possible way to send a POST request over a socket to Eduction 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 Eduction:
application/x-www-form-urlencoded
multipart/form-data
TIP: Eduction rejects POST requests larger than the size specified by the configuration parameter MaxFileUploadSize
.
Application/x-www-form-urlencoded
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, Eduction 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, Micro Focus recommends sending data as multipart/form-data
(see Multipart/form-data).
In the request:
- Separate each parameter from its value with an equals symbol (
=
). - Separate multiple values with a comma (
,
). - Separate each parameter-value pair with an ampersand (
&
). - Base-64 encode any binary data.
- URL encode all non-alphanumeric characters, including those in base-64 encoded data.
Multipart/form-data
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.
NOTE: With 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.