Search code examples
wso2wso2-api-managerwso2-enterprise-integratorapache-synapse

How to access API Version in WSo2 MI backend


I am trying to access the API version set in the API Manager frontend, defined via an openAPI v3.0.3 spec, in the Micro Integrator backend - I can see this is defined in the API Overview page. However I find attempting to access the property API_VERSION in the backend in the axis2 scope returns null (checked by logging out the captured property): Within a property mediator at the beginning of the MI endpoint mediation flow using the following expression get-property('axis2','API_VERSION').

Is there additional configuration required in the front end to pass the API_VERSION set in API-M to the MI backend?

API-M and MI version: 4.2.0

Architecture: Separate nodes for API-M and MI, passing from API-M to MI via exposed Service Endpoint type


Solution

  • Accessing the API Version from the front end does not seem to be possible so instead, I have settled for putting the version information required in the APIResource. This then populates the SYNAPSE_REST_API_VERSION property in the default context.

    If setting the Version Type to URL rather than context the metadata yaml also requires editing to include the version so the correct service URL is called.