qie.addMultipartContentText¶
Signature: qie.addMultipartContentText(builder, name, content, contentType*, fileName*, contentDisposition*)
Returns: void
Adds a text content part to the multipartBuilder object.
Note
This call requires a builder object obtained from a call to qie.getMultipartBuilder().
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| multipartBuilder | builder | multipart builder object | |
| String | name | part name to add; can be null. Required for Content-Disposition form-data type parts | |
| String | content | content to add in part | |
| String | contentType* | (optional) content type for part | text/plain |
| String | fileName* | (optional) filename for part | null |
| String | contentDisposition* | (optional) defines how a part should be presented (e.g., attachment, inline, or form-data, with custom values allowed); attachments require both contentType and fileName parameters, while inline or custom types require the contentType parameter | form-data |
Examples¶
Content-Disposition attachment
// Create a multipart builder
// Step 1: Initialize the Multipart Builder
var multipartBuilder = qie.getMultipartBuilder(); // Use the default boundary and mimeType
// Step 2: Add a plain text part
qie.addMultipartContentText(
multipartBuilder,
null, // Part name (not used for attachment)
"This is plain text content.", // Text content
'text/plain', // Content-Type (required for attachment)
'myFile.txt', // File name (required for attachment)
"attachment" // Make the Content-Disposition attachment, with the filename
);
// Step 3: Send the multipart entity
var value = qie.callRESTWebService(
"Vendor API",
"https://example.com/upload",
"POST",
multipartBuilder,
null, // Use the Content-Type parameter only to specify additional optional attributes (e.g., type or version); the multipart/{mimeType}, and boundary are set automatically by the MultipartBuilder.
qie.newParameterMap(),
60000);
Content-Disposition custom
// Create a multipart builder
// Step 1: Initialize the Multipart Builder
var multipartBuilder = qie.getMultipartBuilder(); // Use the default boundary and mimeType
// Step 2: Add a plain text part
qie.addMultipartContentText(
multipartBuilder,
'textPart', // Part name (not used for custom Content-Disposition)
"This is plain text content.", // Text content
'text/plain', // Content-Type (required for custom Content-Disposition)
null, // File name (not used for custom Content-Displosition)
"alert" // Make the Content-Disposition a custom value of 'alert'
);
// Step 3: Send the multipart entity
var value = qie.callRESTWebService(
"Vendor API",
"https://example.com/upload",
"POST",
multipartBuilder,
null, // Use the Content-Type parameter only to specify additional optional attributes (e.g., type or version); the multipart/{mimeType}, and boundary are set automatically by the MultipartBuilder.
qie.newParameterMap(),
60000);
Content-Disposition inline
// Create a multipart builder
// Step 1: Initialize the Multipart Builder
var multipartBuilder = qie.getMultipartBuilder(); // Use the default boundary and mimeType
// Step 2: Add a plain text part
qie.addMultipartContentText(
multipartBuilder,
null, // Part name (not used for inline)
"This is plain text content.", // Text content
'text/plain', // Content-Type (required for inline)
null, // File name (optional for inline)
"inline" // Make the Content-Disposition inline
);
// Step 3: Send the multipart entity
var value = qie.callRESTWebService(
"Vendor API",
"https://example.com/upload",
"POST",
multipartBuilder,
null, // Use the Content-Type parameter only to specify additional optional attributes (e.g., type or version); the multipart/{mimeType}, and boundary are set automatically by the MultipartBuilder.
qie.newParameterMap(),
60000);
default
// Create a multipart builder
// Step 1: Initialize the Multipart Builder
var multipartBuilder = qie.getMultipartBuilder(); // Use the default boundary and mimeType
// Step 2: Add a plain text part
qie.addMultipartContentText(
multipartBuilder,
'textPart', // Part name
"This is plain text content.", // Text content
'text/plain'); // Content-Type
// Step 3: Send the multipart entity
var value = qie.callRESTWebService(
"Vendor API",
"https://example.com/upload",
"POST",
multipartBuilder,
null, // Use the Content-Type parameter only to specify additional optional attributes (e.g., type or version); the multipart/{mimeType}, and boundary are set automatically by the MultipartBuilder.
qie.newParameterMap(),
60000);