我有一个Web服务器,它公开了一个外部应用程序的接口 .
-
所有方法都作为POST请求发送(读取和写入/更新) .
-
只有一个 endpoints URL用于访问所有方法(“/ serve”) . 在POST主体内部有一个名为“function”的属性,它定义了要调用的方法名称 .
如何在swagger中记录此服务器的API . 一个做类似的东西的例子将不胜感激 .
例如:以下是POST请求的示例正文:
endpoints URL:https://test-web-service.example.com/serve
类型:POST
Body :
getCustomerById
{
"function": "getCustomerById",
"args":
["CUST00001"]
}
getAllCustomers
{
"function": "getAllCustomers",
"args":
[]
}
createCustomer
{
"function": "createCustomer",
"args":
["CUST001","MAC","mailto:mac@example.com","PO Box 39100, Howick"]
}
updateCustomer
{
"function": "updateCustomer",
"args":
["CUST001","MAC OWENS","mailto:mac@example.com","PO Box 39100, Howick"]
}
谢谢!