Share via


File Upload With Azure API Management

Question

Monday, December 18, 2017 7:49 PM

We are attempting to create an API that performs file upload through Azure API Management using the File Upload support specified through OAS 2.0 (I cannot post links but searching OpenAPI it is the File Upload - Swagger link)

When attempting to use type: file we see that it renames it to string after saving.  Does anyone know if there is a specific way to file uploads or if it is not supported yet?

All replies (6)

Tuesday, December 19, 2017 5:29 AM

Could you share the document you are referring to perform File upload operation in Azure APIM with more details of your issue so that we can assist you more.

Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.


Tuesday, December 19, 2017 3:30 PM

There is no document within Azure APIM but I just have a generic OpenAPI version 2.0 page that uses the file-upload part of the spec.

Here is the code of an example of what I want to work within the developer portal through the OpenAPI specification editor:

paths:
  '/trackingOrderNumber/{trackingOrderNumber}/document':
    post:
      description: handleFileUpload
      operationId: handleFileUploadUsingPOST
      parameters:
        - name: trackingOrderNumber
          in: path
          description: trackingOrderNumber
          required: true
          type: string
        - name: eventType
          in: query
          description: eventType
          required: true
          type: string
        - name: document
          in: formData
          required: true
          type: file
      consumes:
        - multipart/form-data
      responses:
        '200':
          description: OK
        '201':
          description: Created
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
      produces:
        - '*/*'

Let me know if you need anymore information.


Wednesday, December 20, 2017 6:05 AM | 1 vote

As it requires more investigation, I would suggest you raise the Support Ticket.

Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.


Wednesday, September 5, 2018 12:58 PM

Any updates on this?


Friday, December 20, 2019 4:48 PM

Two years have passed and the developer portal still can't handle file upload.

Was a support ticket opened? What was the outcome?


Tuesday, February 11, 2020 6:21 PM

Files can be posted using binary body, and indicating content-type

in postman you can test it out, by selecting binary type body, select a local file and posting to your endpoint.

We use a logic app in the backend to receive the file.