Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

API Post (Create) Not Returning a response in body

twenger26
Giga Contributor

I am attempting to use the SN Rest API to create users.  Every time I do a POST (create) with the user account I created I get a response of 201 which is good since it does create the user (sys_user), but the body of the response is blank...

If I use my local account (which has admin role) and do the same thing I do get a body response with fields from that new record.  It appears I have some sort of permission issue.

The weird thing is I can do a get or any other type of API query with that account and all of the field values are returned fine.   It's something about doing the Create which is returning a blank response.  But the record is created so I'm fairly confused.

I don't want to give this new account an "admin" role.  I only want it to be able to create/edit/read  the user, department, and location tables.  So far I've given it these roles with no success on getting a body response:

 

find_real_file.png

6 REPLIES 6

abhimanyu3
Kilo Expert

Strange! I tried with "user_admin" and "web_service_admin" roles (only) and I am able to get a response.

Can you share the Request URL and payload?

twenger26
Giga Contributor

Sure

Request:

https://xxxxxx.service-now.com/api/now/table/sys_user

with body:

{"first_name":"Jordy", "last_name":"Nelson", "user_name":"jnelson"}

response:

{}

Not sure if that's what you are looking for....

I've tried it with Postman, C#, and the REST api explorer.  They all do the same thing.

Not sure where the problem lies. You might want to check the ACLs on User table.

Also, these posts might help:

https://community.servicenow.com/community?id=community_question&sys_id=45d54b21db1cdbc01dcaf3231f961953

https://community.servicenow.com/community?id=community_question&sys_id=c38d472ddb9cdbc01dcaf3231f9619ff