In the case of multipart requests, one or more different sets of data are combined in a single body, where the content type starts with “multipart”. The body of the request contains one or more “body parts,” each preceded by a boundary. Each part mainly having:
- starts with a boundary - and then the body part consisting of the header area - body area
Content-Type: multipart/mixed; boundary=myBoundaryValue
This means the body is having several parts, each part is mostly syntactically identical to an RFC 822 message, except that the header area might be completely empty, and that the parts are each preceded by the line
There are different sub-types of a multipart request, like form-data, mixed, alternative, related, digest, etc.
As of now, webMethods Integration Server (OpenAPI provider and consumer supports only form-data and mixed subtype).
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=“id”
Content-Disposition: form-data; name=“address”
Content-Disposition: form-data; name=“profileImage”; filename="/C:/Users/PMAL/OneDrive - Software AG/Desktop/fp.jpg"
In Multipart request the request will have multiple parts to it like a JSON string along with file content and a few primitive type data as part of a single request, also content types are applied to different parts of a multipart request separated by defined boundaries. As per spec if no content-type is defined for the said parts, we should consider this as the default content type
- Primitive, or an array of primitive values, the default Content-Type is text/plain
- Complex types (Object), or an array of complex values (Object arrays), the default Content-Type is application/JSON
- type: string with format: binary or format: base64, the default content type is application/octet-stream