ramlmule4

How I can mention file as response in RAML 1.0


How I can mention file as response in RAML in RAML 1.0 Example: My Mule API is creating file from sql data so How I can mentioned file as response. I am writing RAML for creating file from sql data?

Is it correct to mention application/csv as response data type?


Solution

  • A file doesn't really have a meaning in a REST API context that RAML models. There is a request body, and a response body. The content type of both can be any MIME type, like application/csv, or application/json, text/xml, etc.

    In conclusion application/csv is a valid content type.

    Example:

    resource:
          get:
            body:
              application/json:
        responses:
          200:
            body:
              application/csv: