Abhijeet Ubale
Abhijeet Ubale

Reputation: 65

WSO2 API Manager - API Definition URL Mapping

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 do I map these in WSO2 API Definition? I tried the below, but it does not seem to work.

API Definition

I get the below 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 the url to invoke something like this

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

Thanks in advance for your help!

Upvotes: 4

Views: 616

Answers (1)

Bee
Bee

Reputation: 12512

You can define 2 resources for 2 cases. (i.e. for with and without query parameters)

enter image description here

In your URL, version is incorrect. 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 drop the version like this.

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

Upvotes: 2

Related Questions