Anypoint Studio Raml Post 表格
Anypoint Studio Raml Post form
我有一个 RAML 文件,我用它来为 APIkit 生成工作流。我想使用 Http 方法 POST 使用“/users”方法创建一个 "user",但我只能让查询参数工作,我想使用表单参数来完成。有人可以展示如何使用 RAML 1.0 制作 Post 表格吗?
以下是我的 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
RAML 1 中不再存在 formParameters
只需在 post 的正文中指定类型,如下所示:
...
post:
body:
type: User
...
我有一个 RAML 文件,我用它来为 APIkit 生成工作流。我想使用 Http 方法 POST 使用“/users”方法创建一个 "user",但我只能让查询参数工作,我想使用表单参数来完成。有人可以展示如何使用 RAML 1.0 制作 Post 表格吗?
以下是我的 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
RAML 1 中不再存在 formParameters
只需在 post 的正文中指定类型,如下所示:
...
post:
body:
type: User
...