Create a new preset at the specified scope level. The preset will be automatically marked as default if it's the first preset created at that scope level for the given key.
URL
(POST) /api/apps/settings/presets/create
PARAMETERS
JSON object in the request body:
|
Property |
Description |
Type |
|---|---|---|
|
scope |
The scope object. It limits resources that can be accessed. |
object, Mandatory |
|
key |
Unique identifier for the preset type |
string, Mandatory |
|
name |
Display name for the preset |
string, Mandatory |
|
desc |
Optional description for the preset |
string?, Optional |
|
content |
JSON configuration data (must be valid JSON) |
string, Mandatory |
|
level |
Target hierarchy level for the preset. If not specified, defaults to "User" level |
string?, Optional |
Valid level values:
-
User: Personal preset visible only to the individual user -
Resource: Resource-specific preset visible to users with access to the resource -
Platform: System-wide preset visible to all users (requires management permissions)
RESULTS
|
Property |
Description |
Type |
|---|---|---|
|
id |
Unique identifier for the created preset |
string |
|
name |
Display name of the preset |
string |
|
desc |
Optional description of the preset |
string? |
|
level |
Hierarchical level where the preset is stored |
string |
|
entityId |
Entity ID associated with the preset level (null for Platform level) |
int? |
|
content |
JSON content of the preset configuration |
string |
|
date |
Creation timestamp |
string (ISO 8601) |
|
isDefault |
Indicates if this preset was set as default (true for first preset at the level) |
bool |
Example Request:
{
"scope": {},
"key": "editor.ui.settings",
"name": "My Custom Editor Config",
"desc": "Dark theme with large font",
"content": "{\"theme\":\"dark\",\"fontSize\":16,\"showLineNumbers\":true}",
"level": "User"
}
Example Response:
{
"id": "abc123def456ghi789",
"name": "My Custom Editor Config",
"desc": "Dark theme with large font",
"level": "User",
"entityId": 1001,
"content": "{\"theme\":\"dark\",\"fontSize\":16,\"showLineNumbers\":true}",
"date": "2023-10-15T14:30:00Z",
"isDefault": true
}
Error Scenarios:
-
Invalid JSON content provided
-
Duplicate preset name at the same scope level
-
Content exceeds maximum size limits
-
Invalid hierarchy level specified
-
Insufficient permissions for target level creation
-
Required fields missing or invalid
-
Management permissions required for Resource/Platform level creation