Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
REST API Explorer - ServiceNow Script has incorrect setHttpMethod values (upper-case). - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • REST API Explorer - ServiceNow Script has incorrect setHttpMethod values (upper-case).
KB0551589

REST API Explorer - ServiceNow Script has incorrect setHttpMethod values (upper-case).


3968 Views Last updated : Oct 16, 2023 public Copy Permalink
KB Summary by Now Assist

Description

The REST API Explorer returns sample scripts for RESTMessageV2 with upper-cased values for "setHttpMethod()". This causes the following exception:

request.setHttpMethod('GET');

java.lang.IllegalArgumentException: No enum const class com.glide.rest.outbound.HTTPOutboundMethod.GET
Caused by error in <refname> at line -1
java.lang.Enum.valueOf(Enum.java:196)
com.glide.rest.outbound.HTTPOutboundMethod.valueOf(HTTPOutboundMethod.java:6)
com.glide.rest.outbound.RESTMessageConfig.setHttpMethod(RESTMessageConfig.java:84)
com.glide.rest.outbound.RESTMessageClient.setHttpMethod(RESTMessageClient.java:132)
com.glide.rest.outbound.scriptable.ScriptableRESTMessageClient.jsFunction_setHttpMethod(ScriptableRESTMessageClient.java:102)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:597)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:504)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.gen.c153513.call(<refname>:40)
org.mozilla.javascript.gen.c153513.exec(<refname>)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:233)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:105)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:72)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:63)
com.glide.script.Evaluator.evaluateString(Evaluator.java:91)
com.snc.automation.ScriptJob.execute(ScriptJob.java:38)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:79)
com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:177)
com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:124)
com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:56)

Changing the call to "request.setHttpMethod('get');" works as expected.

This occurs for all methods. GET / PUT / POST / PATCH / DELETE

Steps to Reproduce

  1. Select a table in REST API Explorer.
  2. Copy the "ServiceNow Script" example.
  3. Run example script in Scripts - Background.

Expected behavior: Results return.

Actual behavior: java.lang.IllegalArgumentException: No enum const class com.glide.rest.outbound.HTTPOutboundMethod.GET

Workaround

Change the generated script so that the HTTP method is lowercase, for example, request.setHttpMethod('get').


Related Problem: PRB646171

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.