Search code examples
anypoint-studioraml

Anypoint Studio Raml Post form


I have a RAML file which I use to generate workflow for APIkit. I want to create a "user" using the "/users" method using Http Method POST but I am only able get the query param working, I want to do it using form parameters. Can someone show how to do a Post Form using RAML 1.0?

The following is my RAML file:

    #%RAML 1.0
---
title: User Resource API
version: 1.0.development
baseUri: http://localhost:8080/jaxrs-example/api/userResource
protocols: [HTTP]
mediaType: application/json
documentation:   
  - title: Home
    content: |
      This is the UserResource manager API docucumentation.  This api allows you
      to add, update and perform other operations on the User API.
types:
  User:
    type: object
    properties:
      firstname: string
      lastname: string
      id: integer
  Firstname:
    type: string
  Lastname:
    type: string  
/users:
  get:
    description: get all users in a collection
    responses: 
      200:
        body:
          application/json: 
            type: User[]
  post:
    description: add user to collection
    body:           
    queryParameters: 
      firstname: string
      lastname: string

Solution

  • formParameters does not exist anymore in RAML 1

    Just specify the type in the body of the post, like this:

    ...
    post:
      body:
        type: User
    ...