2

I was trying to add a user to a group in servicenow using chrome REST client. I found that table api can be used for this user/group management and the table name is "sys_user_grmember". But what should be the ideal format for the endpoint url in this usecase, also do we need to send any query in request header for this operation.

user3269799
  • 33
  • 1
  • 7

1 Answers1

0

Seeing as you are creating a record, you should do a POST request to the sys_user_grmember table as you mentioned. You basically need to enter two parameters to your request, which are user and group. The problem is that you will need to enter their sys_id instead of their name, so you will need to query the sys_user table and sys_user_group table for those sys_ids.

To get sample code for the language you want to use this query in, you can navigate to System Web Services -> REST -> REST API Explorer within your instance, which can provide you with sample code in a bunch of different languages (ie: ServiceNow Script, cURL, Python, Ruby, JavaScript, Perl and Powershell)

Peter Raeves
  • 516
  • 1
  • 4
  • 17