- Open your API assembly in the IBM API Connect Toolkit.
- In the API assembly, right-click on the "File Transfer Policy" node and select "New File Transfer Policy".
- In the "New File Transfer Policy" dialog, enter a name for the policy and select the "Upload" operation.
- In the "Content" section, select the "Binary" content type.
- In the "Parameters" section, add a parameter for the file name.
- Save the file transfer policy.
- In your API definition, add a "POST" operation to the "/upload" endpoint.
- In the "Request Body" section, specify the content type as "application/octet-stream".
- In the "Parameters" section, add a parameter for the file name.
- Save the API definition.
Once you have completed these steps, you will be able to upload files of different types to your IBM API Connect V10 API.
Here is an example of a file transfer policy that you can use:
name: "File Transfer Policy"
description: "Upload files of different types"
operations:
- name: "Upload"
content:
type: "Binary"
parameters:
- name: "fileName"
type: "string"
Here is an example of an API definition that you can use:
openapi: 3.0.0
info:
title: "File Upload API"
version: "1.0.0"
paths:
/upload:
post:
operationId: "uploadFile"
requestBody:
content:
application/octet-stream:
schema:
type: "string"
format: "binary"
parameters:
- name: "fileName"
in: "path"
schema:
type: "string"
responses:
'200':
description: "File uploaded successfully"
I hope this helps! Let me know if you have any other questions.
------------------------------
fron flower
------------------------------
Original Message:
Sent: Tue February 14, 2023 04:56 AM
From: Nrusingha Sahoo
Subject: How to upload a pdf file in IBM API Connect v10 using rest API
I want to upload files of different types like pdf, txt, doc in IBM API Connect V10.
Can any one please help here.
------------------------------
Nrusingha Sahoo
------------------------------