WSO2 API Manager - Defining API URLs

Here is a simplified 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)";
}

How to match them in the definition of the WSO2 API? I tried the following, but it does not seem to work.

API Definition

I get the following error

{"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"}}

I would like url to call something like this

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

Thanks in advance for your help!

+4
source share
1 answer

You can define 2 resources for 2 cases. (i.e. for request parameters and without it)

enter image description here

The version is incorrect in your URL. It should be

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

If the version is the default version, you can simply opt out of this version.

http://localhost:8280/api 
http://localhost:8280/api?id=123
+2
source

Source: https://habr.com/ru/post/1652768/


All Articles