Search code examples
wso2wso2-api-managerwso2-integration-studio

Remove activityid Parameter from response Header in WSO2- API Manager


As you know, by default, WSO2 add a "activityid" Parameter to each response header which would be passed from API-Manager. Reference: https://docs.wso2.com/display/EMM210/Getting+Operation+Details+by+the+Activity+ID

For some reason, I need to remove this parameter from the response for client. As I searched, I find out the following link

https://apim.docs.wso2.com/en/4.0.0/deploy-and-publish/deploy-on-gateway/api-gateway/message-mediation/removing-specific-request-headers-from-response/

So I added following code into Main.XML and Fault.XML, However it doesn't work

<property name="activityid" scope="transport" action="remove"/>

I also add the following property to the data flow of a specific API through Integrator Studio. However it doesnt work

<resource methods="POST" uri-template="/attachment">
    <inSequence>
        <call>
            <endpoint key="attachment"/>
        </call>
        <send/>
    </inSequence>
    <outSequence>
        <property action="remove" name="TRANSPORT_HEADERS" scope="default"/>
        <property action="remove" name="activityid" scope="default"/>
    </outSequence>
    <faultSequence/>
</resource>

Anybody can Give me some advice about this matter??


Solution

  • You can use the message mediation for API Manager. Add the above property mediator to the response path 1 of the API.

    Under runtime configurations of the API, there is a message mediation section for both request and response paths. Here you can upload a mediation sequence which will be executed in the request flow as well as response flow. You can save the mediation you need to an xml file and upload the file for the response flow.

    enter image description here

    1 - https://apim.docs.wso2.com/en/4.0.0/deploy-and-publish/deploy-on-gateway/api-gateway/message-mediation/changing-the-default-mediation-flow-of-api-requests/