Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WSO2 API管理器-API定义URL映射_Wso2_Wso2 Am - Fatal编程技术网

WSO2 API管理器-API定义URL映射

WSO2 API管理器-API定义URL映射,wso2,wso2-am,Wso2,Wso2 Am,下面是一个简化的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":{"

下面是一个简化的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"}}
我希望url能够调用类似这样的内容

http://localhost:8280/api/Default
http://localhost:8280/api/Default?id=123

提前感谢您的帮助

您可以为2个案例定义2个资源。(即有查询参数和无查询参数时)

在您的URL中,版本不正确。应该是

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