I have come across that many users of WSO2 ESB are using it for creating and deploying APIs and they have this requirement to retrieve the details of the API which is being called currently at runtime, from somewhere out side the API (in example from a different sequence outside the API).
Following are some synapse level properties that you can use to get some details of the REST API that is being called at runtime, and how to show those details using the log mediator.
Following are some synapse level properties that you can use to get some details of the REST API that is being called at runtime, and how to show those details using the log mediator.
<property name="apiname" expression="$ctx:SYNAPSE_REST_API"></property> <property name="contxt" expression="$ctx:REST_API_CONTEXT"></property> <property name="urlpre" expression="$ctx:REST_URL_PREFIX"></property> <property name="restmethod" expression="$ctx:REST_METHOD"></property> <log> <property name="*******************URL_PREFIX***********" expression="get-property('urlpre')"></property> </log> <log> <property name="*******************API_NAME***********" expression="get-property('apiname')"></property> </log> <log> <property name="*******************API_CONTEXT***********" expression="fn:substring-after(get-property('contxt'),'/')"></property> </log> <log> <property name="*******************REST_METHOD***********" expression="get-property('restmethod')"></property> </log>
No comments:
Post a Comment