我有一个RAML文件,我用它来为APIkit生成工作流程。我想创建一个"用户"使用" / users"使用Http方法POST的方法,但我只能使查询参数工作,我想使用表单参数。有人可以展示如何使用RAML 1.0进行发布表格吗?
以下是我的RAML文件:
#%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
答案 0 :(得分:1)
formParameters不再存在
只需指定帖子正文中的类型,如下所示:
...
post:
body:
type: User
...