Mikhail Zmeevskiy
Mikhail Zmeevskiy

Reputation: 11

Form-data in API Connect

How do I get request form-data as a string in API Connect? I tried to get it in Gateway script by different ways, like apim.getvariable('request.body') or session.input.readAsBuffer, but everything was unsuccessful. I have two attachments in form-data and I would like to split it in my script.

At the moment I haven't found any documentation about processing form-data in IBM API Connect.

Upvotes: 1

Views: 2509

Answers (1)

Mounir Babari
Mounir Babari

Reputation: 80

If you are using a POST QueryString you can decode the URI component in your Gateway script using:

var myQueryString = decodeURIComponent(apim.getvariable('request.body').item(0).toBuffer().toString())

Upvotes: 1

Related Questions