Using curl, how can you map a role to a user

I know that one can use a curl command similar to the one shown below in order to add a new role, but how can you map/add existing users to the role, once it has been created?

Adding a role using curl…

curl -XPUT https://localhost:9200/_opendistro/_security/api/roles/my-curl-role -u admin:admin -k -H ‘Content-Type: application/json’ -d ‘{“cluster_permissions”:[“cluster_composite_ops”,“indices_monitor”],“index_permissions”:[{“index_patterns”:[“movies*”],“dls”:“”,“fls”:,“masked_fields”:,“allowed_actions”:[“read”]}],“tenant_permissions”:[{“tenant_patterns”:[“human_resources”],“allowed_actions”:[“kibana_all_read”]}]}’

@chuckiechuck Have you tried rolesmapping API?

Hello Pablo! Yes I have! I can’t quite work out the syntax!

Almost all of the roles we are working with already have mapped users! The api states that we should use the PATCH method to add users, but the returned error messages says that PATCH is not a valid/allowed method.

@chuckiechuck PATCH API is disabled by default and I would suggest testing it in the dev environment before going to prod.

Would you mind sharing the curl syntax that you’ve already tried?