ducin ducin - 4 months ago 44
reST (reStructuredText) Question

POST parameters support in RAML

I'd like to ask if there is any support for POST parameters in RAML. And if there is - what is the syntax. I've browsed spec 0.8 and spec 1.0 roughly (actually I'm bound to

, since many tools don't support
yet). I didn't find POST parameters support, but maybe I just missed something.

So what do I mean by POST parameters? These can be either of the two (sorry, I don't know their formal names, if there are any):

  • HTTP plain parameters,
    , each parameter in one line, such as

    name=John Doe
    which is not really handy (e.g. no nesting)

  • parameters as JSON object, just a JSON with all its syntax allowed (server-side needs to parse this json); such as:

    {"name":"John Doe","amount":"5"}

Different server-side API implementations use either 1st or 2nd one. Anyway, how does RAML support these?


@Pedro has covered option 2, so here is option 1. Based on the discussion in the comments, it seems the encoding used is application/x-www-form-urlencoded.

You need to use formParameters.


    description: The POST operation adds an object to a specified bucket using HTML forms.
            description: The AWS Access Key ID of the owner of the bucket who grants an Anonymous user access for a request that satisfies the set of constraints in the Policy.
            type: string
            description: Specifies an Amazon S3 access control list. If an invalid access control list is specified, an error is generated.
            type: string

Reference: https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md#web-forms