AdminApi
Java SDK: the Admin operations, 3 methods, each with its parameters, result and a complete example.
Java SDK · nl.bimbase.bimworks.sdk.api · class · 3 methods
The administration of an organization: its accounts and features
Construct it with the client of the connect step: new AdminApi(client). Each method is one operation of the API part, where it runs on its page.
| Method | Operation | Description |
|---|---|---|
listAccountUserFeatures | ListAccountUserFeatures | The user features of an account |
listAccounts | ListAccounts | List the accounts of the organization |
listOrganizations | ListOrganizations | The caller's organization |
listAccountUserFeatures#
public List<UserFeatureState> listAccountUserFeatures(ListAccountUserFeaturesRequest listAccountUserFeaturesRequest) throws ApiExceptionThe user features of an account. Every user feature with whether the account has it: what the account may do in BIM.works. The caller's own account when account_uuid is absent; another account's needs SuperAdmin.
| Operation | ListAccountUserFeatures · POST /openapi/admin/ListAccountUserFeatures |
|---|---|
| Scope | account:read |
Parameters#
| Name | Type | Description |
|---|---|---|
listAccountUserFeaturesRequest | ListAccountUserFeaturesRequestoptional | The request: its properties are those of the model, its JSON that of ListAccountUserFeatures's request body. |
Returns#
List<UserFeatureState> — The features, by name
Example#
import nl.bimbase.bimworks.sdk.api.AdminApi;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListAccountUserFeaturesRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
public class Example {
public static void main(String[] args) throws Exception {
// 1. Connect to BIM.works and log in with your API token
ApiClient client = new ApiClient();
client.updateBaseUri("https://bim.works/openapi");
Auth auth = new AuthApi(client)
.loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
.getAuth();
client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));
// 2. The request
ListAccountUserFeaturesRequest request = client.getObjectMapper().readValue("""
{
"account_uuid": "00000000-0000-0000-0000-000000000000"
}
""", ListAccountUserFeaturesRequest.class);
// 3. The call
var result = new AdminApi(client).listAccountUserFeatures(request);
// 4. The result
System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
}
}listAccounts#
public List<AccountEntry> listAccounts(ListAccountsRequest listAccountsRequest) throws ApiExceptionList the accounts of the organization. The accounts of the caller's organization, newest first, each with its user and how it signs in. With include_invites the open invites follow the accounts. Removed accounts are left out unless show_deleted. Only a super admin or the organization's creator lists them, with a session or an API token; for any other member the answer is 403 NON_AUTHORIZED_TASK.
| Operation | ListAccounts · POST /openapi/admin/ListAccounts |
|---|---|
| Scope | admin:read |
Parameters#
| Name | Type | Description |
|---|---|---|
listAccountsRequest | ListAccountsRequestoptional | The request: its properties are those of the model, its JSON that of ListAccounts's request body. |
Returns#
List<AccountEntry> — The accounts, then the invites
Example#
import nl.bimbase.bimworks.sdk.api.AdminApi;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListAccountsRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
public class Example {
public static void main(String[] args) throws Exception {
// 1. Connect to BIM.works and log in with your API token
ApiClient client = new ApiClient();
client.updateBaseUri("https://bim.works/openapi");
Auth auth = new AuthApi(client)
.loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
.getAuth();
client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));
// 2. The request
ListAccountsRequest request = client.getObjectMapper().readValue("""
{
"include_invites": false,
"show_deleted": false
}
""", ListAccountsRequest.class);
// 3. The call
var result = new AdminApi(client).listAccounts(request);
// 4. The result
System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
}
}listOrganizations#
public List<Organization> listOrganizations() throws ApiExceptionThe caller's organization. The organization of the caller's account (an empty list when it has none).
| Operation | ListOrganizations · POST /openapi/admin/ListOrganizations |
|---|---|
| Scope | admin:read |
Parameters#
None: the operation takes no request.
Returns#
List<Organization> — The organization
Example#
import nl.bimbase.bimworks.sdk.api.AdminApi;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
public class Example {
public static void main(String[] args) throws Exception {
// 1. Connect to BIM.works and log in with your API token
ApiClient client = new ApiClient();
client.updateBaseUri("https://bim.works/openapi");
Auth auth = new AuthApi(client)
.loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
.getAuth();
client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));
// 2. The request
// (ListOrganizations takes no request)
// 3. The call
var result = new AdminApi(client).listOrganizations();
// 4. The result
System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
}
}