845 views

POST method of REST web service inserts a record but does not generate a response 

 

Problem


Irrespective of using Table or Import Set API, when you use POST method from a REST web service, a record is inserted in the target table but does not see anything in the Response body. Only "Response Headers" brings some inputs, but "Response Body" is empty.

This is considering you have already assigned the rest_service role to the sys_user record you're using for this integration. Additionally, when you assign the admin role to your integration user record, the response appears in "Response Body".

 

Cause


This is an ACL-related issue. There is a write ACL in every ServiceNow instance with the name *.sys_id. In general, this ACL comes as inactive in the base system. When customers activate this ACL, they face this problem.

Investigation steps:

  1. Enable system property glide.rest.debug.
  2. Run the POST method and insert a record in target table.
  3. When you check REST debug logs, you see the following message:
    WARNING *** WARNING *** [REST API] TableAPIService : Created record can't be read. No Record found

 

Solution


Choose one of solutions below that suits you best:

  1. Deactivate this ACL.
  2. If you activated this ACL due to some business requirement, create one more write ACL and give it the role rest_service.

 

Note: REST Logging includes processing durations, headers, and the request body. Prolonged use of this property can affect performance, so it is best to use it while debugging REST processing, and then set the property back to false.

 

 

Article Information

Last Updated:2017-08-17 01:25:46
Published:2016-08-04