I’m trying to create some users and various tokens for my self managed gitlab instance and for gitlab.com saas version.
GitLab Self Managed Instance: Users : Users can be created via the rails console. I see that it can be done using the api, but that would require a PAT of the root user. Also, this PAT can be created only via the UI or rails console. is that correct? Personal Access Token: Personal access tokens can be created via the rails console. Is it possible to create this token using an api? Group Access Token: A group and the group access tokens can be created via the rails console. Is it possible to create this token using an api? Project Access Token: A project can be create via the gitlab projects api. Is there a way to do it via the rails console? Also is there a way to create a project access token programatically?
gitlab.com Saas version: Users : I see that users can be created via UI, but is there a way to do the same programmatically via rails console or an api? I see that there is an api for it, but it says only administrators can create new users. So is it possible to do it for gitlab.com? Personal Access Token: I see that users can be created via UI, but is there a way to do the same programmatically via rails console or an api? Group Access Token: A paid gitlab subscription is required to create these via the console. Is there a way to do this programmatically? Project Access Token: A paid gitlab subscription is required to create these via the console. Is there a way to do this programmatically for both paid and unpaid gitlab versions?
Also, are there any operations that could be done only by using a group and project access tokens and not via personal access tokens?
Thanks! But I see that the apis require a token for calling it. So we’ll have to create a user and PAT via UI/rails console to begin with? Also, from the documentation, it looks like only Admin users are allowed to create new users and PATs using the API. So how can I do it for the gitlab saas version?
I did read the documentation and it says in order to create users and PATs, the pat used in the api should have admin permissions. But from my understanding, the saas version of gitlab does not let normal users have PATs with admin access. So its not possible to create users and PATs programmatically, and this has to be done via UI. Is that correct?
so you can see that Users API does apply to Gitlab.com, and when we look at the create users API section that I linked previously:
as you can see, here clearly it shows that user creation on Gitlab.com is not possible because it doesn’t mention it under Offering. As you also see from the documentation, you have to have an Admin API token to be able to create users. If you are not an admin user, you cannot create users - this is logical, that only Admins have the ability to create users.
Also, even if you are wanting to do this via Rails Console, you still have to be an Admin of the server to gain access to that. And that can be only done on your own server.
Nobody has Admin rights to gitlab.com - only the Gitlab company themselves since the server belongs to them, not to anyboy who just uses it. So your only choice is - run your own server and use the Admin API token that you generate, and script it to create users.
Thankyou! and one more question, is it possible to create users and PATs using the graphql apis? I didnt find any mutations for users or tokens here. I didnt find any mutations for create Project either… is it possible via graphql?