- list - Get a list of all organization permissions
- create - Create a new organization permission
- get - Get an organization permission
- update - Update an organization permission
- delete - Delete an organization permission
Retrieves all organization permissions for the given instance.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ListOrganizationPermissionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
ListOrganizationPermissionsResponse res = sdk.organizationPermissions().list()
.limit(10L)
.offset(0L)
.call();
if (res.permissions().isPresent()) {
System.out.println(res.permissions().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
query |
Optional<String> | ➖ | Returns organization permissions with ID, name, or key that match the given query. Uses exact match for permission ID and partial match for name and key. |
orderBy |
Optional<String> | ➖ | Allows to return organization permissions in a particular order. At the moment, you can order the returned permissions by their created_at, name, or key.In order to specify the direction, you can use the +/- symbols prepended in the property to order by.For example, if you want permissions to be returned in descending order according to their created_at property, you can use -created_at. |
limit |
Optional<Long> | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
offset |
Optional<Long> | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
ListOrganizationPermissionsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 401, 422 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |
Creates a new organization permission for the given instance.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateOrganizationPermissionRequestBody;
import com.clerk.backend_api.models.operations.CreateOrganizationPermissionResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
CreateOrganizationPermissionRequestBody req = CreateOrganizationPermissionRequestBody.builder()
.name("<value>")
.key("<key>")
.build();
CreateOrganizationPermissionResponse res = sdk.organizationPermissions().create()
.request(req)
.call();
if (res.permission().isPresent()) {
System.out.println(res.permission().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
CreateOrganizationPermissionRequestBody | ✔️ | The request object to use for the request. |
CreateOrganizationPermissionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 400, 401, 402, 404, 422 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |
Retrieves the details of an organization permission.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetOrganizationPermissionResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetOrganizationPermissionResponse res = sdk.organizationPermissions().get()
.permissionId("<id>")
.call();
if (res.permission().isPresent()) {
System.out.println(res.permission().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
permissionId |
String | ✔️ | The ID of the permission to retrieve |
GetOrganizationPermissionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 401, 404 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |
Updates the properties of an existing organization permission. System permissions cannot be updated.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.UpdateOrganizationPermissionRequestBody;
import com.clerk.backend_api.models.operations.UpdateOrganizationPermissionResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
UpdateOrganizationPermissionResponse res = sdk.organizationPermissions().update()
.permissionId("<id>")
.requestBody(UpdateOrganizationPermissionRequestBody.builder()
.build())
.call();
if (res.permission().isPresent()) {
System.out.println(res.permission().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
permissionId |
String | ✔️ | The ID of the permission to update |
requestBody |
UpdateOrganizationPermissionRequestBody | ✔️ | N/A |
UpdateOrganizationPermissionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |
Deletes an organization permission. System permissions cannot be deleted.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteOrganizationPermissionResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
DeleteOrganizationPermissionResponse res = sdk.organizationPermissions().delete()
.permissionId("<id>")
.call();
if (res.deletedObject().isPresent()) {
System.out.println(res.deletedObject().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
permissionId |
String | ✔️ | The ID of the permission to delete |
DeleteOrganizationPermissionResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ClerkErrors | 401, 403, 404 | application/json |
| models/errors/SDKError | 4XX, 5XX | */* |