I am trying to implement WSO2 API Manager to handle calls to an API endpoint and do some mediation on the response. I have added an API in the publisher, set a http endpoint to the remote API and implemented some mediators. Everything is working just fine. I have the following mapping: {context}/{version}/RetrieveResource/{resourceid} -> {api server}/RetrieveResource/{resourceid}
Now I want to change the mapping like so: {context}/{version}/Resource/{resourceid} -> {api server}/RetrieveResource/{resourceid}
So I would like that my WSO2 api has the path /Resource/1 that calls the remote api /RetrieveResource/1. Therefore I have tried to use a rewrite mediator in my in-sequence. This changes my "To" header, but does not call the right endpoint path. I call Resource/1, I mediate it to RetrieveResource/1, but WSO2 still calls the endpoint as Resource/1 which ofcourse gives me a 404.
My mediator looks as follows:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="custom_in">
<property name="WSO2_AM_API_ACCEPT_MESSAGE_TYPE" expression="get-property('transport', 'Accept')" scope="default"/>
<property name="Accept" scope="transport" action="remove"/>
<rewrite xmlns="http://ws.apache.org/ns/synapse">
<rewriterule>
<action value="RetrieveResource" regex="Resource" type="replace" fragment="path"/>
</rewriterule>
</rewrite>
</sequence>
I am clearly missing something, any help would be greatly appreciated.