ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Send attached file using Multipart/form-data

book

Article ID: 238084

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

We would like to send file to the backend service through the gateway.

How can we do this on gateway? 

We would like to call the PAPI /asset endpoint on gateway. But we don't know how to achieve sending json file (content-type=multipart/form-data request) on gateway.

Postman call like below:

POST /apiportal/api-management/1.0/apis/922798bd-2def-4be0-983c-54394bf81c70/assets HTTP/1.1
Host:xxxxxxx:9443
Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Length: 196
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="files"; filename="/path/to/file"
Content-Type: <Content-Type header here>

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW

Environment

Release : 10.0

Component : API GATEWAY

Resolution

you have to request the "assemble mime message" tactical assertion to be able to create the correct message format multipart/form-data