Sending Notifications via REST API

Hello ERPNext Community,

I am encountering a challenge while trying to send notifications through the REST API. This is what I get when trying to create a new Notification Log entry:

{
  "exception": "frappe.exceptions.PermissionError",
  "exc_type": "PermissionError",
  "exc": "[\"Traceback (most recent call last):\\n  File \\\"apps/frappe/frappe/app.py\\\", line 110, in application\\n    response = frappe.api.handle(request)\\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"apps/frappe/frappe/api/__init__.py\\\", line 49, in handle\\n    data = endpoint(**arguments)\\n           ^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"apps/frappe/frappe/api/v1.py\\\", line 42, in create_doc\\n    return frappe.new_doc(doctype, **data).insert()\\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \\\"apps/frappe/frappe/model/document.py\\\", line 279, in insert\\n    self.check_permission(\\\"create\\\")\\n  File \\\"apps/frappe/frappe/model/document.py\\\", line 215, in check_permission\\n    self.raise_no_permission_to(permtype)\\n  File \\\"apps/frappe/frappe/model/document.py\\\", line 236, in raise_no_permission_to\\n    raise frappe.PermissionError\\nfrappe.exceptions.PermissionError\\n\"]",
  "_server_messages": "[\"{\\\"message\\\": \\\"\\\", \\\"title\\\": \\\"Message\\\"}\"]",
  "_error_message": "Insufficient Permission for Notification Log (<strong>create</strong>)"
}

I’ve checked the Role Permission Manager, but there’s no ‘create’ option for Notification Log.

Maybe there’s a particular endpoint for creating notifications?

@guilherme

Your Written API has allow_guest = True ? or You are inserting notification with API Token ?

I’m authenticated with the API Token. I can POST to other endpoints with no problem.

@guilherme Share you code here

@guilherme works fine with me bro

After some digging, I found out the request works with the Administrador user, but not with the user I created. This user has all the roles except the Administrator role, which can’t be set in the user’s settings.

Is there any way to set the ‘create’ permission for this Doctype, or can this request only be made by the Administrator?