{"record":{"id":"51b899f5e1444b28","repo":"pentaho/pentaho-kettle","slug":"rest-error-unknownmethod","errorCode":"Rest.Error.UnknownMethod","errorMessage":"Rest.Error.UnknownMethod","messagePattern":"Rest\\.Error\\.UnknownMethod","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java","lineNumber":282,"sourceCode":"   * @param contentType  the content type\n   * @param entityString the entity string\n   * @return the response from the server\n   * @throws KettleException in case the request could not be processed\n   */\n  private Response getResponse( Invocation.Builder invocationBuilder, String contentType, String entityString )\n    throws KettleException {\n    Response response;\n    try {\n      switch ( data.method ) {\n        case RestMeta.HTTP_METHOD_GET -> response = invocationBuilder.get( Response.class );\n        case RestMeta.HTTP_METHOD_POST -> response = invocationBuilder.post( getEntity( contentType, entityString ) );\n        case RestMeta.HTTP_METHOD_PUT -> response = invocationBuilder.put( getEntity( contentType, entityString ) );\n        case RestMeta.HTTP_METHOD_DELETE -> response = invocationBuilder.delete();\n        case RestMeta.HTTP_METHOD_HEAD -> response = invocationBuilder.head();\n        case RestMeta.HTTP_METHOD_OPTIONS -> response = invocationBuilder.options();\n        case RestMeta.HTTP_METHOD_PATCH ->\n          response = invocationBuilder.method( RestMeta.HTTP_METHOD_PATCH, getEntity( contentType, entityString ) );\n        default -> throw new KettleException( BaseMessages.getString( PKG, \"Rest.Error.UnknownMethod\", data.method ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Request could not be processed\", e );\n    }\n    return response;\n  }\n\n  /**\n   * Get entity for request using the given content type or the default one\n   *\n   * @param contentType  the content type\n   * @param entityString the entity string\n   * @return the request entity built using the given content type or the default media type\n   */\n  private Entity<?> getEntity( String contentType, String entityString ) {\n    Entity<?> entity;\n\n    if ( null != contentType ) {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java#L264-L300","documentation":"Rest.getResponse switches on data.method against the known HTTP verbs supported by RestMeta and throws this KettleException in the default branch when the method string matches none of them. The message is localized from Rest.Error.UnknownMethod with the offending method value interpolated.","triggerScenarios":"Dynamic method field contains a value outside {GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH} (case differences or typos like 'get', 'POST ', 'FETCH').","commonSituations":"Typo in a constant/method field; lowercase verb from an API spec or upstream data; method field containing whitespace; user expected synonyms like 'GETLIST' to work.","solutions":["Ensure the method field contains exactly one of GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH in uppercase","Normalize the value upstream: trim and uppercase before the REST step (e.g. via a JavaScript/User Defined Java Expression step)","Check RestMeta.HTTP_METHOD_* constants against the values your data produces","Add a validation step that rejects unknown verbs before they reach the REST step"],"exampleFix":"// before\nString method = row[methodIdx];\n// after\nString method = row[methodIdx] == null ? null : row[methodIdx].trim().toUpperCase();","handlingStrategy":"validation","validationCode":"java.util.Set<String> allowed = java.util.Set.of( \"GET\",\"POST\",\"PUT\",\"DELETE\",\"HEAD\",\"OPTIONS\",\"PATCH\" );\nString m = data.method == null ? null : data.method.trim().toUpperCase();\nif ( m == null || !allowed.contains( m ) ) {\n  throw new KettleException( \"Unsupported HTTP method: \" + data.method );\n}","typeGuard":null,"tryCatchPattern":"try {\n  Response r = step.getResponse( target, row, contentType, entity );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"UnknownMethod\" ) || ( e.getMessage().contains( data.method ) ) ) {\n    log.error( \"Method '\" + data.method + \"' not supported — use GET/POST/PUT/DELETE/HEAD/OPTIONS/PATCH\", e );\n  }\n}","preventionTips":["Normalize the method value (trim + uppercase) in an upstream step","Use a Value Mapper / switch step mapping any synonym to a supported verb","Restrict input with a validation step whitelisting the seven supported verbs","Check RestMeta.HTTP_METHOD_* constants when generating method values programmatically"],"tags":["http","kettle","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}