What is the purpose of group.notify

08-11-2020 03:39 PM
Occasional Contributor III

I stumbed across the group.notify method in the ArcGIS API for Python documentation and thought it would be useful for sending custom notifications to users when content is marked as deprecated or a group owner leaves the company and we need to notify the remaining group admins so that we can identify a new group owner. I gave it a go to test it out and got a 403 response back.

# Sign in to Portal
gis = GIS('https://myportal.domain.com/arcgis', getpass.getuser(), getpass.getpass("Password: "))
my = gis.users.me
for group in my.groups:
    if group.title == 'testing':
        keys = ['admins', 'users']
        members = []
        for key in keys:
            for user in group.get_members()[key]:
    print(group.notify(members, "Test Notification", "This is a test notification", "builtin"))‍‍‍‍‍‍‍‍‍‍‍‍

Specifically, here's the response I'm getting:

You do not have permissions to access this resource or perform this operation.
RuntimeError                              Traceback (most recent call last)
<ipython-input-41-271dd187a943> in <module>
      8                 members.append(user)
      9         print(members)
---> 10     print(group.notify(members, "Test Notification", "This is a test notification", "builtin"))

C:\Miniconda\envs\gis\lib\site-packages\arcgis\gis\__init__.py in notify(self, users, subject, message, method, client_id)
   5566             "f": "json"
   5567         }
-> 5568         return self._gis._con.post(url, params)
   5570     def get_members(self):

C:\Miniconda\envs\gis\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token, try_json, out_folder, file_name, force_bytes, add_headers)
   1181                                          verify_cert=verify_cert, is_retry=True)
-> 1183                 self._handle_json_error(resp_json['error'], errorcode)
   1184                 return None

C:\Miniconda\envs\gis\lib\site-packages\arcgis\_impl\connection.py in _handle_json_error(self, error, errorcode)
   1203         errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")"
-> 1204         raise RuntimeError(errormessage)
   1206 class _StrictURLopener(request.FancyURLopener):

RuntimeError: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I'm an Administrator of the Organization and Owner of this group. It seems this might be a private method available onl to Esri. If so, not cool. Share the wealth. What is the point of group.notify method if no one can use it?

4 Replies
New Contributor III

I have the same issue here, can anyone please shed some light?

0 Kudos
New Contributor III

Been almost a year. Has anyone answered this? I can do this on AGOL/organization page fine but not on my local Enterprise.

0 Kudos
New Contributor II

Been almost 2 years. Has anyone answered this? Tried to do it via the REST APIs same issue... 

Esri Esteemed Contributor

I put together a document on sending notifications using the notify method.

0 Kudos