API user creation and role assignment

You could create a default role for new users, for example: How can I restrict registrating automatically by IdP

If you are working with json then you should check out: jq

Also see (a curl and jq example): wait-for-container-to-exit.sh