Getting rid of request parameters from the request

In most service chaining and API invocations we might come across situations where we will require to remove the initial request URI from the request. If we take for an example the following scenario. 1. We need to obtain some parameters from the users of our API. Therefore we define a resource as below which takes the name and age

What we really need to do is get the name of the student and return the exam grades information. For that we need to invoke a URL in the following format.{}

But with the request URI already been defined in step (1) the request which will be sent is the one below{}?name=Jessie&age=20

Since the backend does not identity a request with such trailing parameters it will fail. How can we get rid of the trailing query parameters from the request (1)?? It’s pretty simple. We have a property in the WSO2 synapse which handles these kind of use cases. When we add the property into our in sequence we can get rid of the trailing request URI. By using this property we then remove the intial request URI

<property name=”REST_URL_POSTFIX” scope=”axis2" action=”remove”/>

After this property is added the requst will be sent out in the following format which is what we finally need.{}

You can add this to your API using custom sequences.