API for a CSV string


#1

Hi,

I have many operations that convert CSV data to other formats, generally CSV or XML.
I’m looking to expose some of these operations as APIs and use RAML to design and build the API contract.
Is this possible? I know that I can provide the input to the request as a string, but really what I’d like to do is define each value in the CSV as a type. For example, something like this:

/translate:
/{product-string}:
post:
body:
text/csv:
type: product
example: |
{
identifier, brand, rating, description, price
}

responses:
200:
body:
application/json:
type: product
example:

etc…


#2

Please try and make your RAML “preformatted text”, the “</>” button in the editor, and use indentation.
I’m a lazy bastard, and while i might copy-paste your spec to run something on it, i sure won’t be re-indenting it.

That “product” type, what would you want it to be? Not the same thing in and out i assume?
What is “product-string?”
Do you want nice documentation, or mostly a spec to automate from?

Perhaps your body could be a string and you use (user defined) facets for defining your fields/columns. Those are accessible programmatically at least… Also, if example doesn’t cut it, you can go bonkers with markdown in the description. :slight_smile: