0

I setup a GET scripted rest API. However, when I try to send a GET request with a body, ServiceNow (before it hits my code) complains that GET is not allowed to have a body.

Is there a way to disable this restriction? For now as a temporary workaround, I converted the request into a POST. However, this request does not change any state, so I believe it should be a GET. The request only searches for existing items.

joseph
  • 2,429
  • 1
  • 22
  • 43

1 Answers1

1

GET is used without body, any configuration of a GET is in the URL and header. A query URL looks like this:

https://instance.service-now.com/api/now/table/problem?sysparm_query=active=true^ORDERBYnumber^ORDERBYDESCcategory&sysparm_limit=1

See the documentation here: https://developer.servicenow.com/app.do#!/rest_api_doc?v=madrid&id=r_TableAPI-GET

Generally it's OK to use a POST to get data, graphQL does this for example, but i think SNOW is configured for GETs only.

Gordon Mohrin
  • 645
  • 1
  • 6
  • 17