Modify¶
POST /api/v1/workspace/declaration/modify
Overview¶
Replaces the current workspace declaration as a whole. Custom fields are converted to strings, and the organization identifier is maintained by the system.
Before You Call and Usage Steps¶
Use the API Key of the target workspace. The workspace is determined by the Key; do not pass workspaceUUID separately in the Query or Body. A workspace declaration is a key-value configuration used for business identification and display in responses. It is not an interface for data access authorization, billing organization migration, or resource renaming.
Read and back up the complete declaration first, then submit the declaration object. Modification replaces the old configuration as a whole: custom keys that are not submitted are removed; {} clears the old custom keys. organization is forcibly overwritten by the server; if business is omitted or null, it becomes an empty string, strings are trimmed of leading and trailing whitespace, and other values are JSON-stringified; other non-string custom values are also converted to JSON strings. You cannot use attribute values to change the owning organization or permissions.
For free/freeEdition workspaces, true is currently returned directly and nothing is saved, so do not treat HTTP 200 as an actual change. For other editions, the cache is refreshed after submission; for paid editions, writes may fail when organization information is unavailable, and for deployment editions organization is the fixed default_private_organization. A successful call returns only a boolean, so read the declaration again to confirm. Cache refresh failures may occur after submission; if an error occurs, read the declaration back first before deciding whether to retry. Background organization synchronization may also modify declaration values again; defer to the server result for organization-related fields.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from the API Key management of the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| declaration.organization | string | Overwritten by the system value even if passed; cannot be used to switch organizations. Example: organization_exampleHow to obtain or fill in: Determined by the server based on the workspace edition and organization information; the caller may omit it. |
|
| declaration.business | Any JSON value | Optional; omitted/null becomes an empty string; strings are trimmed of leading and trailing whitespace, and arrays/objects/numbers/booleans become JSON strings rather than retaining their original structure.Example: checkoutHow to obtain or fill in: Fill in the business ownership identifier; for multiple ownerships, agree on a stable string among yourselves. |
|
| declaration.{custom key} | Any JSON value | Custom attributes can be placed here. Strings are saved as-is; non-strings are converted via json.dumps; do not rely on JSON object/number types being preserved. Subsequent background synchronization may also modify values/whitespace. Example: platformHow to obtain or fill in: Replace the placeholder with the actual key name agreed by the team, for example costCenter. |
|
| declaration | json | Y | Required JSON object; non-objects should be rejected during parameter validation. {} is valid but clears old custom keys and only rebuilds the system organization and business; it is not an incremental patch.Allows null: False Example: {"business": "checkout", "costCenter": "platform"}How to obtain or fill in: First read the current declaration, retain the top-level business/custom keys that are still needed, remove the common auxiliary declaration, and submit the whole object. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/declaration/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"declaration":{"business":"checkout","costCenter":"platform"}}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | Returns true after processing completes; for Free/Free Plan editions, it is currently true with no modification, so read back to confirm. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
Organization upstream failures may retain their actual error code/message; defer to this response. Dynamic downstream errors are not falsified as the fixed parameter 406. Requests do not contain workspaceUUID, brand, or Boss node fields; these are determined by the current workspace.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | The request JSON syntax is invalid | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 401 | ft.WKSPNotExistOrReleased | The current workspace does not exist or has been released | Workspace does not exist/or has been released | Verify the Key ownership and workspace status. |
| 406 | ft.InvalidBossNode | The paid/enterprise edition organization node configuration does not exist | Invalid Boss node | Contact the administrator to fix the organization site configuration; the caller does not need to submit brand/node fields. |
| 500 | ft.InternalServerError | Organization upstream, storage submission, or cache refresh failed | Internal error | Keep the traceId; read back first to confirm whether it was saved, then decide whether to retry. |
| 400 | ft.JsonFormatError | The top level of the request JSON is not an object, for example an array or string | Some json file format errors | Submit a JSON object containing a declaration object. |