Reputation: 53
I'm using WSO2 API Manager Version 2.0.0. Within the API Publisher, I added a POST endpoint to my API using an in path parameter.
POST /person/{id}
Everything works fine. The path parameter id
is added to the endpoint.
But this does not work if the path contains a .
character somewhere. Adding POST /cool.person/{id}
will result in an empty parameter list. Also, it is not possible to add a parameter manually to this endpoint.
Am I doing something wrong or is this a bug?
Upvotes: 0
Views: 597
Reputation: 293
According to my knowledge and due my findings on this, both POST /person/{id}
and POST /cool.person/{id}
are correct.
I think the issue is in your endpoint, your end point is not giving permission to you to add another entry via a POST method.
I followed your path and I couldn't reproduce your situation, but I found that need permission from endpoint to put another entry there.
I'll attach my synaps file and snap shot of the response
<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
name="admin--UrlTest"
context="/paternType/1.0"
version="1.0"
version-type="context">
<resource methods="POST" url-mapping="/persons.list" faultSequence="fault">
<inSequence>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<send>
<endpoint name="admin--UrlTest_APIproductionEndpoint_0">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</then>
<else>
<send>
<endpoint name="admin--UrlTest_APIsandboxEndpoint_0">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
<resource methods="POST" url-mapping="/persons" faultSequence="fault">
<inSequence>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<send>
<endpoint name="admin--UrlTest_APIproductionEndpoint_1">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</then>
<else>
<send>
<endpoint name="admin--UrlTest_APIsandboxEndpoint_1">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
<resource methods="GET" url-mapping="/personlist" faultSequence="fault">
<inSequence>
<property name="api.ut.backendRequestTime"
expression="get-property('SYSTEM_TIME')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<send>
<endpoint name="admin--UrlTest_APIproductionEndpoint_2">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</then>
<else>
<send>
<endpoint name="admin--UrlTest_APIsandboxEndpoint_2">
<http uri-template="http://jsonplaceholder.typicode.com/posts?"/>
<property name="ENDPOINT_ADDRESS"
value="http://jsonplaceholder.typicode.com/posts?"/>
</endpoint>
</send>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
<property name="apiImplementationType" value="ENDPOINT"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/>
<handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/>
<handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler">
<property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
</handlers>
</api>
Jeewana.
Upvotes: 1