How to create an external ldap role using the REST API?

What is the best way to create an external ldap role using the REST API?

I thought that posting something like

{
  "description": "ACL_GRAFANA_editor",
  "id": "ACL_GRAFANA_editor",
  "source": "ldap",
  "name": "ldap-ACL_GRAFANA_editor"
}

to /service/rest/v1/security/roles would do the trick, but I get the response

id          : ACL_GRAFANA_editor
source      : default
name        : ldap-ACL_GRAFANA_editor
description : ACL_GRAFANA_editor
privileges  : {}
roles       : {}

i.e., source is set to default, not ldap

It appears we don’t currently support creating external role mappings via the REST API (due to not including a source field) and at first glance I didn’t find an open ticket to add the functionality to the REST API. If you’d like this functionality added, please open a ticket on issues.sonatype.org against the “Dev - Nexus Repo (NEXUS)” project. That will help us track the requests for this functionality and may help get it prioritized.