So as far, as I understood, I can directly affect an existing role while creating the User1 account, but I would like to create a specific role which allows him to only read and search from the mytest index.
I found a "createrole" parameter for the last cURL, but it's not clear from the documentation.
So is it possible to create / specify the role while creating a new user? Or is there any other cURL command which can create a role?
You can create a role for the user but not sure if you can customize the role that way. Better option is to create the role separately (before creating user) with all the customization (index access) and then assign that role to the user while creating (or update if already created). See this link for roles creation curl using Splunk REST API