Embeddable AI

 View Only
  • 1.  How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Tue February 14, 2023 09:04 AM

    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
    ------------------------------


  • 2.  RE: How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Fri April 07, 2023 09:04 AM

    To upload files of different types like pdf, txt, doc in IBM API Connect V10, you can use the File Transfer Policy in the API assembly.

    Here are the steps to add a File Transfer Policy to your API:

    1. Open your API assembly in the IBM API Connect Toolkit.

    2. Select the "Assembly" tab and then select the "Policies" sub-tab.

    3. Click on the "+" icon to add a new policy, and select "File Transfer Policy" from the list.

    4. In the policy editor, configure the policy as needed. You can specify the allowed file types, the maximum file size, and other options.

    5. Save the policy and then add it to the appropriate flow in your assembly.

    6. Deploy the API to your IBM API Connect instance .

    With the File Transfer Policy added to your API, clients will be able to upload files of the specified types through the API. The files will be passed as binary data in the request body and can be accessed by your API implementation.
    Referance ehsaas program 



    ------------------------------
    micle loginsd
    ------------------------------



  • 3.  RE: How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Mon August 07, 2023 10:10 AM
    1. Open your API assembly in the IBM API Connect Toolkit.
    2. In the API assembly, right-click on the "File Transfer Policy" node and select "New File Transfer Policy".
    3. In the "New File Transfer Policy" dialog, enter a name for the policy and select the "Upload" operation.
    4. In the "Content" section, select the "Binary" content type.
    5. In the "Parameters" section, add a parameter for the file name.
    6. Save the file transfer policy.
    7. In your API definition, add a "POST" operation to the "/upload" endpoint.
    8. In the "Request Body" section, specify the content type as "application/octet-stream".
    9. In the "Parameters" section, add a parameter for the file name.
    10. 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
    ------------------------------