0
votes

I am using wso2 API manager 1.6.0 and would like to create an API which accepts any POST

on /users resource followed by any query parameter such as "clientid" (as described below)

restserver.com:8280/context/1/users?clientid=333

I have created an API in API publisher as follow :

URL Prefix URL Pattern HTTP Verb

/context/1 /users/* POST

Any POST on /users is accepted but as sson as I add a query paramter /users?clientid=333 , the request is rejected by the API Manager gateway with 403 error.

Could someone advice me on this and what should be the correct url-mapping format ?

The resulting url-mapping in synapse config file is as follow : (synapse-configs/default/api/)

Thanks a lot.

JS

1

1 Answers

0
votes

For this you need to define uri-template instead of uri-mapping. This blog post explains more about this.

For your case I got it working as following.

  • Open your API configuration source which can be found at AM_HOME\repository\deployment\server\synapse-configs\default\api folder.

  • In the resource tag change url-mapping="/users/*" attribute to uri-template="/users/*"

But you will have to invoke the API as follows with additional context because when you say /users/* it means anything can come after users/. So you need to have a / after users context.

restserver.com:8280/context/1/users/usr?clientid=333