我正在使用RAML定义API,我需要返回图像内容(而不是JSON)。任何特殊的提示如何在我的API中公开方法“内容”?
/images/{imageId}:
get:
responses:
200:
body:
application/json:
...
/images/{imageId}/content:
答案 0 :(得分:1)
对于RAML 1,您可以使用file type,例如:
...
types:
userPicture:
type: file
fileTypes: ['image/jpeg']
maxLength: 307200
...
/images/{imageId}:
get:
responses:
200:
body:
image/jpeg:
type: userPicture
For RAML 0.8 the file type is only aplicable to formParameters.
但您仍然可以使用媒体类型,例如:
/images/{imageId}:
get:
responses:
200:
body:
image/jpeg:
description: an image...