Search code examples
wso2wso2-api-manager

how to change error message for not allowed htttp methods when calling an API resource in wso2 API manager?


I created a rest api in wso2 api manager publisher add add a resource for example delivery and only assign post method for calling this api resource , by default when use other http methods for calling this api , api manager throws below response :

<am:fault xmlns:am="http://wso2.org/apimanager">
  <am:code>405</am:code>
  <am:type>Status report</am:type>
  <am:message>Runtime Error</am:message>
  <am:description>Method not allowed for given API resource</am:description>
</am:fault>

and in some http methods like COPY it throws 400 bad request ,first I want to don't show above message in response and only give back the status code and nothing in response message and second show 405 method not allowed for all http methods except POST method.


Solution

  • You can modify the default fault sequence in order the change the message. Take a look at this document.