Update Group Supervisors from REST API

Not Yet Reviewed

I am trying to make some adjustments to our ServiceNow integration with xMatters. Based on the documentation from the API docs, it shows that supervisors is an accepted field for modification and that it accepts, what looks like an array of strings but this doesn't seem to make sense although I have tried that along with a simple string.

This request ultimately fails and doesn't seem to like this field for supervisors. Any tips on how to make this POST request with a custom supervisor?



Date Votes

Please sign in to leave a comment.

  • I confirmed I was able to update the supervisors for one of our groups via the API. Below are the parameters used on the POST call (written in Python).

    url = f'{base_url}/groups'
    headers = {'Content-Type': 'application/json'}
    data = {'id': 'a881c7f7-f392-4429-970b-19111fb3d04e',
    'supervisors': [
    {'id': '61327ab0-8ae3-47c4-8f64-bf01d3728099'},
    {'id': 'e3f479c7-d9b3-4aa0-a465-4f707c0669dc'}]

    I hope this helps.

    - Hallie

  • Hi Michael, one thing to double-check is that the person you're assigning as supervisor has group supervisor permissions. Once I gave my person the group supervisor role, I was able to assign them. Also note that it is a replacement, not additive, so you need to add all the users you want - including any existing ones - to the request.

  • Hi Michael,

    Including the JSON from the HTTP response for the HTTP request you sent would help identify the issue since it should contain an error message.

    Without seeing the HTTP response, both Hallie and Christine have pointed out the two important aspects of making this work. The supervisors property accepts an array of strings where each string must contain the identifier (UUID) of the user that you want to be assigned as a supervisor of the Group.  Each user in this array must have the appropriate permissions to be a group supervisor, and if any user in the list that does not qualify will result in an error (403) response.

    Also, Christine points out that specifying the supervisors field will replace the entire list of supervisors. So when specifying this field you should provide a list of ALL the users you want as supervisors of the group.

    If you find that this doesn't help, please post back here with the HTTP response you are getting and we'll help you out.


  • I know it has been a while since this was originally posted but I am experimenting using Flow Designer to add a person to the existing group supervisors on a group.

    For both the group and the supervisors you have to use the id not targetName.

    You can  do a call  to get the supervisors:

    var apiRequest = http.request({
        'endpoint': 'xMatters',
        'path': '/api/xm/1/groups/' + input['groupID'] + '/supervisors',
        'method': 'GET'

    then loop through to build array of existing supervisors

              for (i = 0; i <response.count; i++) {    //loop for supervisor ids in that group

                  sups.push ( { "id":  response.data[i].id} );


    And finally add in the id of the new supervisor assuming they have the Group Supervisor role.

    sups.push ( { "id":  input.personID} );

    Now you have an array to POST.


Didn't find what you were looking for?

New post