The recommended way to engage a mediation extension sequence per API is to upload an XML file through the registry create a custom sequence using WSO2 Developer Studio, upload it via the APIM Perspective and then engage it using the API Publisher. The following tutorial shows demonstrates how to do this: Change the Default Mediation Flow of API Requests.
You can also create a custom sequence manually and upload it from the API Publisher itself. In the Implement tab of the API, select the Enable Message Mediation check box and click Choose File in the In Flow or Out Flow field. Once the file is uploaded, save the API.
Alternatively, you can name the mediation XML file in the pattern
<API_NAME>:v<VERSION>--<DIRECTION> and save it directly in the following location:
When you invoke your REST API via a REST Client, configure that client to have a custom header (Authentication) for your basic authentication credential and configure the ‘Authorization’ header Authorization header to contain the bearer token for the API. When you send the Authentication and Authorization headers, the Gateway drops the Authorization header, converts the Authentication to Authorization headers and sends to the backend.