Identity API - Identity V1¶
Manage invitations, roles, and users within the identity system.
| Apaleo Identity API · Identity V1 | |
|---|---|
| Swagger UI | https://identity.apaleo.com/swagger/index.html?urls.primaryName=Identity+V1 |
| Client | ApaleoAPIClient |
| API | ApaleoAPIClient.identity |
| Version | ApaleoAPIClient.identity.v1 |
| Resource | ApaleoAPIClient.identity.v1.identity |
Methods¶
Method-focused reference for Apaleo Identity API's Identity V1.
Invitation¶
list_invitations¶
Returns a list of all invitations to the current account.
Endpoint Mapping
GET /api/v1/invitations
SDK Method
list_invitations(params: InvitationListParams | None = None) -> InvitationList
# Without parameters
invitations = await client.identity.v1.identity.list_invitations()
print(invitations)
# With parameters
params = InvitationListParams(property_id="BER")
invitations = await client.identity.v1.identity.list_invitations(params)
print(invitations)
create_invitation¶
Invites a person to the current account with the requested roles and properties.
Endpoint Mapping
POST /api/v1/invitations
SDK Method
create_invitation(payload: CreateInvitation) -> InvitedUserToAccountResponse
payload = CreateInvitation(
email="james.twelvetrees@invalid.com",
properties=["BER"],
is_account_admin=False,
role=RoleInvitedTo.HOUSEKEEPING,
)
invited_user = await self.adapter.create_invitation(payload=payload)
print(invited_user)
delete_invitation¶
Deletes an invitation by email.
Endpoint Mapping
DELETE /api/v1/invitations/{email}
SDK Method
delete_invitation(email: str) -> None
await client.identity.v1.identity.delete_invitation(email="james.twelvetrees@invalid.com")
Roles¶
list_roles¶
Returns a list of all roles in the current account.
Endpoint Mapping
GET /api/v1/roles
SDK Method
list_roles() -> RoleList
roles = await client.identity.v1.identity.list_roles()
print(roles)
Users¶
list_users¶
Returns a list of all users that have access to the current account.
Endpoint Mapping
GET /api/v1/users
SDK Method
list_users(self, params: UserListParams | None = None) -> UsersList
users = await client.identity.v1.identity.list_users()
print(users)
params = UserListParams(property_ids=["BER", "VIE"], page_size=50, page_number=1)
users = await client.identity.v1.identity.list_users(params)
print(users)
Concurrent data fetching is supported
Concurrent pagination is supported for list_users. You can fetch multiple pages of results concurrently by passing batch_size and is_concurrently=True in the parameters.
params = UserListParams(batch_size=50, is_concurrently=True)
users = await client.identity.v1.identity.list_users(params)
print(users)
get_user¶
Returns a user in the current account for a specific subjectId.
Endpoint Mapping
GET /api/v1/identity/users/{subjectId}
SDK Method
get_user(user_id: str) -> User
user = await client.identity.v1.identity.get_user(user_id="some_subject_id")
print(user)
update_user¶
Modify user in an account.
Endpoint Mapping
PATCH /api/v1/identity/users/{subjectId}
SDK Method
update_user(self, user_id: str, payload: list[Operation]) -> None
payload = [
Operation(
op="replace",
path="/enabled",
value=True,
),
Operation(
op="add",
path="/properties",
value=["BER", "VIE"],
),
]
await client.identity.v1.identity.update_user(
user_id="some_subject_id",
payload=payload,
)
get_current_user¶
Returns details for the current user.
It does not work with client credentials flow, as there is no user context in that case.
Endpoint Mapping
GET /api/v1/users/me
SDK Method
get_current_user() -> User
current_user = await client.identity.v1.identity.get_current_user()
print(current_user)