MuleSoft · APIkit for REST

APIKIT:METHOD_NOT_ALLOWED

Short answer

APIKIT:METHOD_NOT_ALLOWED is the APIkit for REST error type that maps to HTTP status 405 with the response message "Method not allowed". APIkit validates incoming requests against your RAML or OAS API specification, so compare the failing request with the specification.

Needs verificationLast reviewed

Needs verification. The error type, its HTTP status code and its response message are confirmed in the APIkit error handling reference. The documentation pages checked do not state exactly which request condition raises this type, so the causes below are not confirmed. Treat it as a starting point, not as a confirmed fix.

01Error text

MuleSoft error
Error type: APIKIT:METHOD_NOT_ALLOWED

HTTP status: 405
Response message: Method not allowed

02Likely causes

  • Unconfirmed: the resource exists in the API specification, but not with the HTTP method the request used.
  • APIkit for REST automatically validates incoming requests against the API contract defined in RAML or OAS.

03How to fix it

  1. Check which HTTP methods the API specification defines for the requested resource.
  2. Compare the failing request with the API specification the APIkit router uses, and correct whichever of the two is wrong.
  3. To control what the caller receives, add an On Error Propagate handler with the type APIKIT:METHOD_NOT_ALLOWED that sets the response body and an httpStatus variable of 405. The APIkit scaffolder can generate this baseline handler.
  4. Adapt the handler if your API needs a custom status code or message.

iNotes

The APIkit router has attributes that change what it validates: queryParamsStrictValidation (validates that request query parameters are defined in the RAML file), headerStrictValidation (validates that request headers are defined in the RAML file or belong to a well-known set of headers) and disableValidations (disables validations of requests).

04Official documentation

Test every fix in a non-production environment before you apply it to production. See how entries are verified.

More for MuleSoft work:Open MuleSoft jobsMuleSoft rates and salariesHire a senior MuleSoft developer

The iPaaS Brief

Subscribe to The iPaaS Brief.

The iPaaS newsletter for the people who run integrations. From iPaaS Group.

Free. You finish on theipaasbrief.com and confirm by email.