Skip to content

Add



POST /api/v1/wksp_share/add

Overview

Add a data query authorization for another workspace on the current site.

Before Calling and Usage Steps

Create/Modify/Delete uses the API Key of the data grantor workspace; read operations follow the authorization direction of the current Key's workspace. This group authorizes data query capabilities between workspaces, not inviting members, granting account roles, or copying data. In the response, workspaceUUID is the grantor and toWorkspaceUUID is the grantee; only Body.workspaceUUID in the add request indicates the target workspace being authorized, which is opposite in direction to the response field of the same name. Whether a query takes effect is also limited by the data domain, log indexes, filter conditions, actual authorization status, and source workspace status.

Create/Modify/Delete requires dataRightsManage.workspaceConfigManage. First use Authorization List with type=grant to read records issued by the current workspace itself, and take content.data[].uuid; do not treat UUIDs of other source workspaces in the grantee list as configurations you can modify. When the result is unknown, read the configuration back first to avoid duplicate authorization or mistakenly assuming that a failure did not execute anything.

This add operation supports only a different valid target workspace on the same site (rejected when the target versionType=freeEdition); regionCode cannot create a new cross-site relationship. For cross-site, use Generate Meta and Import Meta workflows. workspaceUUID is one at a time; type/indexes form the complete authorization scope. A successful save does not verify that the indexes actually exist and does not mean downstream queries have succeeded.

The add operation first commits the record, then prepares the site name/optional notification and audit. An internal notification error may only be logged; a successful API response does not guarantee email delivery; other preparation failures after commit may also return 500 while the configuration already exists. Creating again with the same source/target/site combination returns 406 already authorized. When the result is unknown, read the existing record first.

For this add operation, omitting conditions or using {} indicates no additional conditions; there is no old configuration to retain. Only the three arrays metric/tracing/rum are exposed; lineage sub-conditions are not supported (although the shared internal validator recognizes this name). Extra Body fields are rejected. Array elements should be objects: op must be in/not in, and value must be an array; within the same category, logic must be consistent, preferably and/or. Currently, the logic enum, required name, and object shape of array elements are not strictly validated; malformed elements may return 500, and a successful save cannot be relied upon to prove that conditions are valid. Conditions in different data domains do not authorize each other, nor do they mean that data domains without configured conditions are prohibited.

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 API Key Management in the target workspace.

Body Request Parameters

Parameter Type Required Description
conditions.metric[*] json A condition object. The following subfields are semantic guidance; currently there is no complete upfront per-item validation.
Example: {"name": "host", "op": "in", "logic": "and", "value": ["example-value"]}
How to obtain or fill in: Fill in one set of conditions for each item in the array.
conditions.metric[*].name string Actual field name, not the field configuration UUID.
Example: host
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.metric[*].op string Conditionally required Must be in or not in; missing or other values return 406.
Example: in
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.metric[*].logic string Recommended and/or; must be consistent within the same domain. The enum is not strictly validated currently, and missing values also participate in consistency comparison.
Example: and
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.metric[*].value array Conditionally required Must be an array; fill in elements according to the actual field type. An empty array cannot be understood as all.
Example: ["example-value"]
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.tracing[*] json A condition object. The following subfields are semantic guidance; currently there is no complete upfront per-item validation.
Example: {"name": "service", "op": "in", "logic": "and", "value": ["example-value"]}
How to obtain or fill in: Fill in one set of conditions for each item in the array.
conditions.tracing[*].name string Actual field name, not the field configuration UUID.
Example: service
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.tracing[*].op string Conditionally required Must be in or not in; missing or other values return 406.
Example: in
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.tracing[*].logic string Recommended and/or; must be consistent within the same domain. The enum is not strictly validated currently, and missing values also participate in consistency comparison.
Example: and
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.tracing[*].value array Conditionally required Must be an array; fill in elements according to the actual field type. An empty array cannot be understood as all.
Example: ["example-value"]
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.rum[*] json A condition object. The following subfields are semantic guidance; currently there is no complete upfront per-item validation.
Example: {"name": "app_id", "op": "in", "logic": "and", "value": ["example-value"]}
How to obtain or fill in: Fill in one set of conditions for each item in the array.
conditions.rum[*].name string Actual field name, not the field configuration UUID.
Example: app_id
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.rum[*].op string Conditionally required Must be in or not in; missing or other values return 406.
Example: in
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.rum[*].logic string Recommended and/or; must be consistent within the same domain. The enum is not strictly validated currently, and missing values also participate in consistency comparison.
Example: and
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
conditions.rum[*].value array Conditionally required Must be an array; fill in elements according to the actual field type. An empty array cannot be understood as all.
Example: ["example-value"]
How to obtain or fill in: Construct according to the fields and allowed business values of the domain.
workspaceUUID commaArray Y Required single workspace UUID string. The legacy type name commaArray is only used for string validation; this endpoint does not split by commas for batch creation. Do not submit an array or multiple IDs.
Allowed null: False
Example: wksp_target
How to obtain or fill in: The grantee provides the actual UUID from its workspace information/console; it cannot be the current grantor itself.
type array Y Required array; * means all; [] does not mean all. The public declaration allows null, but subsequent business logic may return 500, so be sure to submit an array. Enum values are not validated item by item; arbitrary unknown values are not recommended.
Allowed null: True
Example: ["metric", "logging"]
How to obtain or fill in: Select according to the domains actually to be authorized, such as metric/logging/tracing/rum/object/custom_object/lineage, etc., subject to support by the target query capability.
indexes array Y Required array. Saved when type contains * or logging; otherwise forcibly cleared to []; * means all indexes, and [] does not mean all. Saving does not check whether each index actually exists.
Allowed null: False
Example: ["default"]
How to obtain or fill in: Take name from the grantor's Log Index List, not the configuration UUID; with explicit pagination the path is content.data[].name, and without pagination it is the native content[].name.
regionCode string Optional; omission/empty string uses the current site; a Code from another site returns 406, not arbitrary cross-site creation as claimed in old documentation.
Allowed null: False
Empty string allowed: True
Example: SITE-CODE
How to obtain or fill in: Omit it to use the current site; for an explicit value, the site administrator must provide a Code exactly matching the current site.
conditions json For this add operation, omitting conditions or using {} indicates no additional conditions; there is no old configuration to retain. Only the three arrays metric/tracing/rum are exposed; lineage sub-conditions are not supported (although the shared internal validator recognizes this name). Extra Body fields are rejected. Array elements should be objects: op must be in/not in, and value must be an array; within the same category, logic must be consistent, preferably and/or. Currently, the logic enum, required name, and object shape of array elements are not strictly validated; malformed elements may return 500, and a successful save cannot be relied upon to prove that conditions are valid. Conditions in different data domains do not authorize each other, nor do they mean that data domains without configured conditions are prohibited.
Allowed null: False
Example: {"metric": [{"name": "host", "op": "in", "logic": "and", "value": ["host-example"]}]}
How to obtain or fill in: Construct the minimum allowed scope according to the grantor's real fields and values.
conditions.metric array Optional condition array; omitting it or using [] does not add filtering for this category; this add operation saves the submitted values.
Allowed null: False
Example: [{"name": "host", "op": "in", "logic": "and", "value": ["example-value"]}]
How to obtain or fill in: Select filter conditions from actual metric fields and values.
conditions.tracing array Optional condition array; omitting it or using [] does not add filtering for this category; this add operation saves the submitted values.
Allowed null: False
Example: [{"name": "service", "op": "in", "logic": "and", "value": ["example-value"]}]
How to obtain or fill in: Select filter conditions from actual tracing fields and values.
conditions.rum array Optional condition array; omitting it or using [] does not add filtering for this category; this add operation saves the submitted values.
Allowed null: False
Example: [{"name": "app_id", "op": "in", "logic": "and", "value": ["example-value"]}]
How to obtain or fill in: Select filter conditions from actual rum fields and values.

Additional Parameter Notes

For same-site add and condition scope, see this page; the old cross-site request parameter description no longer applies.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/wksp_share/add' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"workspaceUUID":"wksp_target","type":["metric","logging"],"indexes":["default"],"conditions":{"metric":[{"name":"host","op":"in","logic":"and","value":["host-example"]}]}}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content.id integer Internal row number; not used as an API resource identifier.
content.uuid string Authorization configuration UUID, usually with the grant_ prefix; use this value for details/modification/deletion.
content.workspaceUUID string UUID of the grantor workspace to which the API Key used in this call belongs; for the target workspace, see toWorkspaceUUID.
content.workspaceName string Grantor workspace name.
content.toWorkspaceUUID string Target workspace that receives the data query authorization.
content.toWorkspaceName string Grantee workspace name.
content.regionCode string Grantor site identifier.
content.toRegionCode string Target site identifier; on read, legacy empty values are filled according to compatibility rules.
content.siteRelationType string Site relationship such as same_site/same_org_cross_site/external_org_cross_site; historical records may be empty.
content.sourceBaseUrl string Source address of some cross-site records; may be empty for ordinary same-site records and is not the API Endpoint of this call.
content.targetBaseUrl string Target address of some cross-site records; may be empty for ordinary same-site records.
content.type array/string or null Saved authorized data domains; * means all. Historical data may not be normalized, and status 0 alone cannot be used to determine validity.
content.type[] JSON Usually a data domain string; the current legacy entry point does not fully check element enums.
content.indexes array or null Set of authorized log index names, not index UUIDs; * means all, and it is saved as [] when the logging domain is not authorized.
content.indexes[] string One index name, such as default.
content.conditions object or null Filter configuration saved by metric/tracing/rum; not the data permission itself or query results.
content.extra object or null Record role, authorization status, and cross-site extensions. Read and write responses have different cleanup rules; do not share raw write responses containing authentication diagnostics externally.
content.extra.recordRole string Such as authority/mirror; only some records have it.
content.extra.grantStatus string Status saved in the record; on read, pending may be displayed as expired based on time.
content.delayDeleteAt integer Scheduled deletion time; -1 usually means not scheduled; does not mean the record is necessarily valid.
content.status integer Model status; 0 is not deleted, and deletion is usually 3; for business authorization, also check grantStatus, etc.
content.creator string Creator identifier; may be an API Key UUID or a historical account/system identity.
content.updator string Most recent operator; may be empty.
content.createAt integer Creation Unix seconds.
content.updateAt integer Update Unix seconds; may initially be -1.
content.deleteAt integer Soft-delete Unix seconds; usually -1 when not deleted.
content.conditions.metric array Condition array for the metric category.
content.conditions.metric[] object A set of conditions; currently elements do not have complete upfront structure validation.
content.conditions.metric[].name string Actual field name.
content.conditions.metric[].op string in or not in.
content.conditions.metric[].logic string Recommended and/or; must be consistent within the same category; the enum is not strictly validated currently.
content.conditions.metric[].value array Condition value array; elements follow the actual field type.
content.conditions.tracing array Condition array for the tracing category.
content.conditions.tracing[] object A set of conditions; currently elements do not have complete upfront structure validation.
content.conditions.tracing[].name string Actual field name.
content.conditions.tracing[].op string in or not in.
content.conditions.tracing[].logic string Recommended and/or; must be consistent within the same category; the enum is not strictly validated currently.
content.conditions.tracing[].value array Condition value array; elements follow the actual field type.
content.conditions.rum array Condition array for the rum category.
content.conditions.rum[] object A set of conditions; currently elements do not have complete upfront structure validation.
content.conditions.rum[].name string Actual field name.
content.conditions.rum[].op string in or not in.
content.conditions.rum[].logic string Recommended and/or; must be consistent within the same category; the enum is not strictly validated currently.
content.conditions.rum[].value array Condition value array; elements follow the actual field type.
content.authorizationCode string or null Legacy authentication field in write responses; not a normal customer query parameter; do not share publicly.
content.name string Target workspace name attached at creation.
content.declaration object or null Workspace public declaration for non-empty business objects; may be null or an empty object when not configured; not attached for empty business objects.
content.extra.tempAuthCodeExpireAt integer Unix seconds of the temporary authorization package validity period; may be omitted; not an authentication code that can be used directly.
content.extra.pendingTargetWorkspaceUUID string Expected target workspace of a pending record; may be omitted.
content.extra.metaUUID string Authorization package identifier; may be omitted and is not the grant configuration UUID.
content.extra.grantScopeFingerprint string Authorization scope digest; may be omitted and is not used as a customer authentication parameter.
content.extra.createdAt integer Extension record creation Unix seconds; may be omitted.
content.extra.authorityGrantUUID string Source authorization configuration UUID associated with a mirror record; may be omitted and cannot be directly treated as a configuration owned by the current Key's workspace.
content.extra.sourceKid string Source site public key identifier; may be omitted.
content.extra.sourceJwksUri string Source site public key set address; may be omitted.
content.extra.syncStatus string Cross-site sync status, such as success/failed or empty; may be omitted.
content.extra.lastSyncAt integer Last sync Unix seconds; may be omitted.
content.extra.lastSyncError string Adapted summary of the most recent sync error; may be omitted and is not the outer error code of this API call.
content.extra.lastSyncErrorAt integer Most recent sync failure Unix seconds; may be omitted.
content.extra.resourceSummary object Resource summary synchronously saved by some cross-site records; may be omitted; not a real-time complete resource list.
content.extra.resourceSummary.logging object Logging resource summary; may be omitted.
content.extra.resourceSummary.logging.indexes array Log index summary items synchronized from upstream; elements may be strings or objects and are saved as-is.
content.extra.resourceSummary.logging.indexes[] JSON One index summary; do not assume a fixed uuid/name shape; before operating on an index, still obtain actual parameters from the index list.
content.extra.resourceSummary.rum object RUM resource summary; may be omitted.
content.extra.resourceSummary.rum.applications array Upstream RUM application summary items; strings or objects as actually returned.
content.extra.resourceSummary.rum.applications[] JSON Application summary; not a substitute for the current site's application configuration UUID.
content.extra.resourceSummary.updatedAt number Numeric value when the resource summary was generated; the unit is determined by upstream, and Studio does not perform unit conversion or guarantee uniformity.
content.extra.resourceSummary.sourceGrantUUID string Source authorization configuration identifier associated with the resource summary.
content.extra.sourceSite object Snapshot of the grantor/grantee site identity; may be omitted and does not replace the current request Endpoint.
content.extra.sourceSite.siteCode string Site code. May be omitted.
content.extra.sourceSite.regionCode string Region code. May be omitted.
content.extra.sourceSite.name string Site display name. May be omitted.
content.extra.sourceSite.issuer string Signing identity. May be omitted.
content.extra.sourceSite.baseUrl string Site API base address. May be omitted.
content.extra.sourceSite.jwksUri string Public key set address. May be omitted.
content.extra.sourceSite.kid string Public key identifier. May be omitted.
content.extra.sourceSite.publicKeys array Some site snapshots contain public key material; may be omitted; no private keys.
content.extra.sourceSite.publicKeys[] object Optional public key item.
content.extra.sourceSite.publicKeys[].kid string Public key identifier.
content.extra.sourceSite.publicKeys[].publicKey string PEM public key body.
content.extra.targetSite object Snapshot of the grantor/grantee site identity; may be omitted and does not replace the current request Endpoint.
content.extra.targetSite.siteCode string Site code. May be omitted.
content.extra.targetSite.regionCode string Region code. May be omitted.
content.extra.targetSite.name string Site display name. May be omitted.
content.extra.targetSite.issuer string Signing identity. May be omitted.
content.extra.targetSite.baseUrl string Site API base address. May be omitted.
content.extra.targetSite.jwksUri string Public key set address. May be omitted.
content.extra.targetSite.kid string Public key identifier. May be omitted.
content.extra.targetSite.publicKeys array Some site snapshots contain public key material; may be omitted; no private keys.
content.extra.targetSite.publicKeys[] object Optional public key item.
content.extra.targetSite.publicKeys[].kid string Public key identifier.
content.extra.targetSite.publicKeys[].publicKey string PEM public key body.
content.extra.resourceSummary.metric object Resource summary for the corresponding domain; may be omitted.
content.extra.resourceSummary.metric.workspaceUUIDs array Set of source workspace identifiers saved during synchronization; elements are usually strings; not authorization for the current Key to operate arbitrarily on workspaces.
content.extra.resourceSummary.metric.workspaceUUIDs[] JSON Individual workspace identifier as actually returned by upstream; historical items that are not fully normalized need to be verified first.
content.extra.resourceSummary.tracing object Resource summary for the corresponding domain; may be omitted.
content.extra.resourceSummary.tracing.workspaceUUIDs array Set of source workspace identifiers saved during synchronization; elements are usually strings; not authorization for the current Key to operate arbitrarily on workspaces.
content.extra.resourceSummary.tracing.workspaceUUIDs[] JSON Individual workspace identifier as actually returned by upstream; historical items that are not fully normalized need to be verified first.
content.extra.resourceSummary.lineage object Resource summary for the corresponding domain; may be omitted.
content.extra.resourceSummary.lineage.workspaceUUIDs array Set of source workspace identifiers saved during synchronization; elements are usually strings; not authorization for the current Key to operate arbitrarily on workspaces.
content.extra.resourceSummary.lineage.workspaceUUIDs[] JSON Individual workspace identifier as actually returned by upstream; historical items that are not fully normalized need to be verified first.
{
  "code": 200,
  "content": {
    "id": 10,
    "uuid": "grant_example",
    "workspaceUUID": "wksp_source",
    "toWorkspaceUUID": "wksp_target",
    "regionCode": "SITE-CODE",
    "toRegionCode": "SITE-CODE",
    "workspaceName": "授权方示例空间",
    "toWorkspaceName": "被授权方示例空间",
    "authorizationCode": null,
    "siteRelationType": "same_site",
    "sourceBaseUrl": "",
    "targetBaseUrl": "",
    "extra": {
      "recordRole": "authority",
      "grantStatus": "active"
    },
    "type": [
      "metric",
      "logging"
    ],
    "indexes": [
      "default"
    ],
    "conditions": {
      "metric": [
        {
          "name": "host",
          "op": "in",
          "logic": "and",
          "value": [
            "host-example"
          ]
        }
      ]
    },
    "delayDeleteAt": -1,
    "status": 0,
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": -1,
    "deleteAt": -1,
    "name": "被授权方示例空间",
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

This endpoint only adds same-site authorization and does not actively use the legacy cross-site creation chain. Email notifications are not an acceptance condition for business success.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError Body is not an object Some json file format error Submit the JSON object on this page.
406 ft.WorkspaceGrantConditionOperatorInvalid Condition element op is missing or is not in/not in The operator for authorization scope {} conditions supports only in or not in Fill in in or not in for each item, and keep the field consistent with the business scope.
406 ft.WorkspaceGrantConditionValueMustBeList Condition element value is not an array The value field of authorization scope {} conditions must be a list Use a JSON array; do not submit a comma-separated string.
406 ft.WorkspaceGrantConditionLogicMixed Multiple different logic values appear in the same category (including mixing missing values with and) Authorization scope {} conditions do not support mixing different logical operators Set logic to either and or or consistently for all conditions in the same category.
406 ft.WKSPShareInvalid The source or target workspace is invalid/nonexistent/inactive, the target versionType=freeEdition, validation fails for reasons other than the target being invalid/equal to the source, or regionCode is not the current site Invalid workspace uuid Check the current source record and the actual target workspace status; use scope fields supported by the public Body and do not attempt to replace the target workspace/site.
406 ft.WKSPIllegalAuthorization Attempting to authorize the current grantor workspace to itself Data authorization requires a workspace ID other than the current workspace. Please fill it in again. Fill in a different grantee target workspace UUID.
406 ft.WKSPRepeatAuthorization A record with status=0 already exists for the same source/target/site (grantStatus is not additionally checked) The workspace is already authorized. Do not authorize it again! Read the existing configuration first, and modify it as needed instead of creating it again.
500 ft.InternalServerError type=null is processed by subsequent code, condition element structure is abnormal, a storage error occurs, or cache/site information preparation fails after commit Internal error First read back the list/details to verify whether it has been saved; retain the traceId before deciding whether to retry; do not assume the entire operation has been rolled back.

Feedback

Is this page helpful?