Multiple Content Types in single request

Hello there,

We need to post request with below parameters from apigee.

Here are the parameters for the POST request:

  • Front: A file parameter containing the front image data in binary format.
  • Back: A file parameter containing the back image data in binary format.
  • Item: The Item parameter contains XML.

Front,Back in binary format & Item in XML are been extracted from prior response & need to construct the request to submit as a new request but how to add multiple types of content in single request?

This is to submit a check images(front/back & sample item details) to a vendor.

-Vinay

0 6 16.4K
6 REPLIES 6

@vinay poreddy

Great Question, Here is what i think about same, If you see definition of the header field:

https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7

	Content-Type = "Content-Type" ":" media-type

So it takes a single media-type, which is defined by the grammar quoted above. So the answer is: a single type/subtype, followed by optional parameters.

Regarding your requirement,

You said, "submit a check images(front/back & sample item details) to a vendor" , I am sure vendor has a webservice that already defines how the request should be sent. Just use the same format vendor specified.

If you mean sending this data to Apigee Edge, You can send it as xml & binary data inside xml as base64 encoded format. More about same here. You can decode same before sending to to the vendor service.

I am checking with vendor but as per spec they say as below. I am confused to understand the file parameter portion as per the spec.

==

For example, the following request submits a single item as a decoupled image upload and that includes all item data to the system. An HTTP request header must be included.

Authorization: MTFiM2I2OTMtYTczMC00OWNmLWFhOGEtYzY0YjM2MWJhNGJj
Content-Type: multipart/form-data;
boundary=-----------------------------28947758029299
Host: xxxx Content-Length: 634045

You should submit each image as a binary stream with POST parameters. The front and back image are each a file parameter containing image data as a data stream.

==

The api doc is little confusing.

I can share the doc if you provide me email id & pick some ideas to implement.

-Vinay

@vinay poreddy , You might need to contact the vendor / post complete docs here by masking endpoint details , credentials, any confidential details.

I'm not clear. From where is the request originating?

From within Apigee Edge?

From the outside client?

Normally Apigee Edge acts as a proxy for external clients, and Edge connects to some backend system. In the normal case Edge acts as a pass through , and what the client sends to edge, Edge sends to the backend.

If that's what you're doing here, then Edge does not need to construct a message.

If Edge is acting as an intelligent proxy and is manipulating the inbound message in some way, then yes, you need Edge to construct a message of the form the backend requires.

This is a multipart/form message, with some binary content. To manipulate binary content in Edge you will need to resort to a java callout or a nodejs target.

If you clarify what you want I can provide more details.

Request needs to be originated from Apigee to Vendor api call.

Apigee-> Vendor API.

Its a submit check POST call with back& front images with some meta data.

Parameters for the POST request:

  • Front: A file parameter containing the front image data in binary format.
  • Back: A file parameter containing the back image data in binary format.
  • Item: The Item parameter contains XML.

Front/Back image will be

Api doc is attached with in earlier post.Please suggest as how to form multipart/form message?

-Vinay

Looking for suggestions.