[RFD - 0005] - User Management API #195
Replies: 1 comment
-
Alternative API Proposal for Members/Group Management This proposal presents an alternative approach for the Members/Group APIs. In this design, we propose using To address scenarios where users must be identified by their GitHub or Bitbucket login, we suggest leveraging a filter on the Members API list. This would enable retrieval based on VCS information without direct reliance on external providers. This alternative proposal remains aligned with the guidelines established in our API design guide, ensuring consistency with our existing architecture while offering additional flexibility. Members APIhttps://{organization_name}.semaphoreci.com/api/v2/members Resource format{
"apiVersion": "v1",
"kind": "Member",
"metadata": {
"user_id": "f1d8a9b9-1234-4567-89de-9876543210ef",
"organization_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a"
},
"spec": {
"name": "Jane Doe",
"avatar": "https://example.com/avatar.jpg",
"roles": [
{
"role_id": "6d8f21a4-6f36-4b3c-93a3-9123456789ab",
"role_name": "Organization Owner",
"source": "manually_assigned",
"assigned_at": "2024-09-15T10:30:00Z"
}
],
"github_account": {
"id": "6162642",
"name": "jane-github"
},
"bitbucket_account": {
"id": "{3d87b6e2-45b9-4e7f-b9cd-1a2f3d4b567a}",
"name": "jane-bitbucket"
},
"joining_at": "2023-01-05T08:30:00Z",
"last_activity_at": "2024-09-05T14:20:00Z"
}
} We are omitting emails to prevent potential leaks. Someone could invite every Semaphore user and collect their emails. Standard MethodsList (+ filter by github/bitbucket login/uid) Custom MethodsInvite (github/bitbucket + optional role) Groups APIhttps://{organization_name}.semaphoreci.com/api/v2/groups Resource format{
"apiVersion": "v1",
"kind": "Group",
"metadata": {
"organization_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a",
"created_at": "2023-09-01T12:00:00Z",
"updated_at": "2023-09-05T15:00:00Z"
},
"spec": {
"name": "Developers",
"slug": "developers",
"description": "",
"roles": [
{
"role_id": "6d8f21a4-6f36-4b3c-93a3-9123456789ab",
"role_name": "Member",
"source": "manually_assigned",
"assigned_at": "2024-09-15T10:30:00Z"
}
]
}
} Standard MethodsList Custom MethodsAddRole Group Members APIhttps://{organization_name}.semaphoreci.com/api/v2/groups/{group_name_or_id}/members Resource format{
"apiVersion": "v1",
"kind": "GroupMember",
"metadata": {
"user_id": "f1d8a9b9-1234-4567-89de-9876543210ef",
"organization_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a",
"group_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a"
},
"spec": {
"name": "Jane Doe",
"avatar": "https://example.com/avatar.jpg",
"github_account": {
"id": "6162642",
"name": "jane-github"
},
"bitbucket_account": {
"id": "{3d87b6e2-45b9-4e7f-b9cd-1a2f3d4b567a}",
"name": "jane-bitbucket"
},
"joining_at": "2023-01-05T08:30:00Z"
}
} Standard MethodsCreate user_id Project Membershttps://{organization_name}.semaphoreci.com/api/v2/projets/{project_name_or_id}/members Resource format{
"apiVersion": "v1",
"kind": "ProjectMember",
"metadata": {
"user_id": "f1d8a9b9-1234-4567-89de-9876543210ef",
"organization_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a",
"project_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a"
},
"spec": {
"name": "Jane Doe",
"avatar": "https://example.com/avatar.jpg",
"roles": [
{
"role_id": "6d8f21a4-6f36-4b3c-93a3-9123456789ab",
"role_name": "Contributor",
"source": "manually_assigned",
"assigned_at": "2024-09-15T10:30:00Z"
}
],
"github_account": {
"id": "6162642",
"name": "jane-github"
},
"bitbucket_account": {
"id": "{3d87b6e2-45b9-4e7f-b9cd-1a2f3d4b567a}",
"name": "jane-bitbucket"
},
"joining_at": "2023-01-05T08:30:00Z"
}
} Standard MethodsList Custom MethodsAddRole (user_id + role_name/slug) Project Groupshttps://{organization_name}.semaphoreci.com/api/v2/projets/{project_name_or_id}/groups Resource format{
"apiVersion": "v1",
"kind": "ProjectGroup",
"metadata": {
"group_id": "f1d8a9b9-1234-4567-89de-9876543210ef",
"organization_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a",
"project_id": "b78c3f9e-4a71-4b1b-88e5-df2a4bb0df5a"
},
"spec": {
"name": "Developers",
"slug": "",
"description": "",
"roles": [
{
"role_id": "6d8f21a4-6f36-4b3c-93a3-9123456789ab",
"role_name": "Contributor",
"source": "manually_assigned",
"assigned_at": "2024-09-15T10:30:00Z"
}
],
"joining_at": "2023-01-05T08:30:00Z"
}
} Standard MethodsList Custom MethodsAddRole (group_id + role_name/slug) |
Beta Was this translation helpful? Give feedback.
-
[RFD - 0005] - User Management API
@radwo
@hamir-suspect
@AleksandarCole
In queue
What
A new User Management API for Semaphore is the proposed extension of the new
v2 api
that is currently being built. This API will handle:Key features:
Why
Use cases
Dev onboarding automation
Consultancy project juggling
Compliance reporting
Sync with other IAM systems
This API isn't just a nice-to-have. It's addressing real pain points our users face daily. By implementing this, we're not just adding a feature – we're solving critical user management problems and opening up new possibilities for how our users can use and integrate Semaphore in their workflows.
Feature description - API specification
Table of Contents
Organizations API
Base URL:
https://me.semaphoreci.com/api/v2/organizations
List Organizations
Retrieves a list of all organizations that the authenticated user is a member of.
HTTP Request
GET /organizations
Query Parameters
Response
Describe Organization
Retrieves detailed information about a specific organization.
HTTP Request
GET /organizations/{org_identifier}
Where
{org_identifier}
can be either the organization name or the organization ID.Response
Organization Users API
Base URL:
https://me.semaphoreci.com/api/v2/organizations/{org_identifier}
Where
{org_identifier}
can be either the organization name or the organization ID (e.g.,ff19729a-a8d5-4a62-8c5c-9bdbabf6607e
).List Users in Organization
Retrieves a list of all users within a specified organization.
HTTP Request
GET /users
Query Parameters
Response
Describe User in Organization
Retrieves detailed information about a single user within an organization.
HTTP Request
GET /users/{user_identifier}
Where
{user_identifier}
can be the user's UUID, GitHub username, or Bitbucket username.Response
Create User in Organization
Adds a new user to an organization.
HTTP Request
POST /users
Request Body
Response
Update User in Organization
Updates an existing user's organization role and/or group memberships within an organization.
HTTP Request
PATCH /users/{user_identifier}
Request Body
Response
Delete User from Organization
Removes a user from an organization.
HTTP Request
DELETE /users/{user_identifier}
Response
A successful deletion returns an HTTP 204 No Content status.
Error Response
Project Users API
Base URL:
https://me.semaphoreci.com/api/v2/projects/{project_identifier}
Where
{project_identifier}
can be either the project name or the project ID (e.g.,18b40eaf-ce10-49c3-93f2-e4fe72d5160b
).List Users in Project
Retrieves a list of all users associated with a specific project.
HTTP Request
GET /users
Query Parameters
Response
Describe User in Project
Retrieves details of a specific user within a project.
HTTP Request
GET /users/{user_identifier}
Where
{user_identifier}
can be the user's UUID, GitHub username, or Bitbucket username.Response
Add User to Project
Adds a user to a project with specified roles.
HTTP Request
POST /users
Request Body
Response
Update Project User Roles
Updates the roles of a user within a project.
HTTP Request
PATCH /users/{user_identifier}
Request Body
Response
Remove User from Project
Removes a user from a project.
HTTP Request
DELETE /users/{user_identifier}
Response
A successful removal returns an HTTP 204 No Content status.
Error Response
Notes on Role Assignment
User Groups API - Optional Extended Scope
Base URL:
https://me.semaphoreci.com/api/v2/organizations/{org_identifier}/user-groups
Where
{org_identifier}
can be either the organization name or the organization ID (e.g.,ff19729a-a8d5-4a62-8c5c-9bdbabf6607e
).List User Groups
Retrieves a list of all user groups within a specified organization.
HTTP Request
GET /user-groups
Query Parameters
Response
Describe User Group
Retrieves detailed information about a specific user group.
HTTP Request
GET /user-groups/{group_identifier}
Where
{group_identifier}
can be either the group name or the group ID.Response
Create User Group
Creates a new user group within the organization.
HTTP Request
POST /user-groups
Request Body
Response
Update User Group
Updates an existing user group's details.
HTTP Request
PATCH /user-groups/{group_identifier}
Request Body
Response
Delete User Group
Deletes a user group from the organization.
HTTP Request
DELETE /user-groups/{group_identifier}
Response
A successful deletion returns an HTTP 204 No Content status.
Add User to Group
Adds a user to a user group.
HTTP Request
POST /user-groups/{group_identifier}/users
Request Body
Response
Remove User from Group
Removes a user from a user group.
HTTP Request
DELETE /user-groups/{group_identifier}/users/{user_identifier}
Response
A successful removal returns an HTTP 204 No Content status.
Assign Group to Project
Assigns a user group to a project with a specified role.
HTTP Request
POST /user-groups/{group_identifier}/projects
Request Body
Response
Unassign Group from Project
Unassigns a user group from a project.
HTTP Request
DELETE /user-groups/{group_identifier}/projects/{project_identifier}
Response
A successful unassignment returns an HTTP 204 No Content status.
Common Status Codes
Beta Was this translation helpful? Give feedback.
All reactions