这是一个简化的ASP.NET Web API
public string Get() {
return $"Received value: 1,2 in string Get()";
}
public string Get([FromUri] int id) {
return $"Received value: {id} in Get(int id)";
}
如何在WSO2 API定义中映射这些?我尝试了以下,但似乎没有用.
我得到以下错误
{"fault":{"code":900906,"message":"No matching resource found in the API for the given request","description":"Access failure for API: /api/1.0, version: 1.0 status: (900906) - No matching resource found in the API for the given request. Check the API documentation and add a proper REST resource path to the invocation URL"}}
我希望网址能够调用这样的东西
http://localhost:8280/api/Default
http://localhost:8280/api/Default?id=123
在此先感谢您的帮助!
最佳答案 您可以为2个案例定义2个资源. (即有和没有查询参数)
在您的网址中,版本不正确.它应该是
http://localhost:8280/api/1.0.0
http://localhost:8280/api/1.0.0?id=123
如果版本是默认版本,您可以简单地删除这样的版本.
http://localhost:8280/api
http://localhost:8280/api?id=123