Reputation: 11
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
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