Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

SNOW Table POST API now not returning INC number and SYSID in response, it's just giving 201 status

User739474
Tera Contributor

SNOW Table POST API now not returning INC number and SYSID in response, it's just giving 201 status. 

It was working earlier, but now response body is empty. Any reason this is stopped ? Not finding in SNOW docs also. Please help.

 

User739474_0-1788616911895.png

 

2 ACCEPTED SOLUTIONS

IbrarA
Tera Guru

Hi @User739474

A 201 with an empty body usually points at read access rather than the API itself. The create succeeds because the write side passes, but the record is echoed back through a read, and when that fails you get the status with nothing in it.

Quickest way to confirm is to run the same call with an admin account. If the body comes back, it's access on the integration user.

Since it was working before, check what changed for that user, a role removed, a new ACL on incident, or a before query business rule limiting what they can read. Worth checking the Accept header is set to application/json too.

Same behaviour discussed here: https://www.servicenow.com/community/developer-forum/api-post-create-not-returning-a-response-in-bod...

 

 

Thanks

ibrar

View solution in original post

vaishali231
Kilo Sage

hey @User739474 

201 Created means the Incident is being created successfully. If the response body has suddenly become empty, first check whether X-no-response-body: true is being sent in the request.

If not, check the *.sys_id write ACL and test with the integration user vs. admin. Also verify that sys_id is not being sent in the POST payload.

The Location response header can also be checked to get the newly created record's sys_id.

*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

Regards

Vaishali Singh
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb





View solution in original post

5 REPLIES 5

IbrarA
Tera Guru

Hi @User739474

A 201 with an empty body usually points at read access rather than the API itself. The create succeeds because the write side passes, but the record is echoed back through a read, and when that fails you get the status with nothing in it.

Quickest way to confirm is to run the same call with an admin account. If the body comes back, it's access on the integration user.

Since it was working before, check what changed for that user, a role removed, a new ACL on incident, or a before query business rule limiting what they can read. Worth checking the Accept header is set to application/json too.

Same behaviour discussed here: https://www.servicenow.com/community/developer-forum/api-post-create-not-returning-a-response-in-bod...

 

 

Thanks

ibrar

vaishali231
Kilo Sage

hey @User739474 

201 Created means the Incident is being created successfully. If the response body has suddenly become empty, first check whether X-no-response-body: true is being sent in the request.

If not, check the *.sys_id write ACL and test with the integration user vs. admin. Also verify that sys_id is not being sent in the POST payload.

The Location response header can also be checked to get the newly created record's sys_id.

*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

Regards

Vaishali Singh
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb





Aditya_hublikar
Giga Sage

Hello @User739474 ,

 

Are you using the same URL with the parameters as shown below?

https://devxxxx.service-now.com/api/now/table/incident?sysparm_fields=number%2Csys_id

 

With above parameters , url will send response body as attach image 

 

Aditya_hublikar_0-1788709332803.png

 

 

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya

 

 

User739474
Tera Contributor

For GET API with sysId, we are getting below error response:

404 Not found:
{
"error": {
"message": "No Record found",
"detail": "Record doesn't exist or ACL restricts the record retrieval"
},
"status": "failure"
}

Any recent changes in the ACL list/user roles? This was working earlier, now it's not.