What is the correct way to describe GET for downloading files of different MIME type


#1

I want to design to a GET and POST entry point for downloading different kinds of files (.doc, .png, .zip, etc)

What is the right way to describe the spec for both GET and POST? can anyone point me to an example maybe?


#2

@tavopb24 - just to double check, your goal is to document an endpoint that has a get and a post attached to it where you are able to upload and download files. am i right?


#4

@christian_vogel Correct! i am having trouble defining this endpoint using RAML


#5

Maybe the jukebox example can help you then: https://github.com/mulesoft/raml-tutorial-200/blob/master/jukebox-api.raml

Let me know if that helps.


#6

For headers/body when GET file I used next structure:

    responses:
      200:
        description: File with requested ID.`
        headers:
          Content-type:
              displayName: Content-type
              description: File's MIME type ("video/mp4", etc.)
              type: string
              required: true
        body:
          binary/octet-stream:
            type: file
          mpeg/mp4:
            type: file