title: Retrieve HTTP response code in WSO2 ESB/API Manager
body: <p>I'm using WSO2 API Manager and I want access to details of the client's incoming API request (into API Manager, for example, the HTTP method) as well the response from my API endpoint. I've followed the approach in the following document to write a custom mediator class which gets invokes on both the "In" (for the request) and "Out" (for the response) flows:</p>
  
  <p><a href="https://docs.wso2.org/display/AM160/Adding+a+Mediation+Extension" rel="nofollow">https://docs.wso2.org/display/AM160/Adding+a+Mediation+Extension</a></p>
  
  <p>It seems I can get various bits of data that I need from the <code>MessageContext</code> that is passed into my mediator, but I'm struggling with getting the response code from my API endpoint. Is there a way to get access to the HTTP response itself (and all it's headers and other elements) from the <code>MessageContext</code>? I stumbled across the <code>PassThroughTransportUtils</code> class which has a <code>determineHttpStatusCode</code> method which I could call but I'm not sure this is the best way of doing it.</p>