Create¶
POST /api/v1/snapshots/create
Overview¶
Save a page snapshot or force rebuild a snapshot with the same name.
Prerequisites and Usage Steps¶
The current Key must have snapshot.create permission. What is saved is the page and query configuration, not a physical copy of all telemetry; the data retention period, query service, and saved authorization scope still affect subsequent viewing. By default, a new snapshot is Workspace-public with isPublic=1 (not an internet share); public creation does not accept isPublic/isHidden/accountUUID/rules.
When an active record with the same Workspace, type, and name exists, isForce=false reports a duplicate name; true overwrites the entire content object on the same UUID, re-collects query/masking authorization from the current calling Key, and changes accountUUID and generation time; it does not inherit the original creator's broader permissions. The original filterType is not updated by a forced overwrite, and the original creator may still be the principal. Existing shares pointing to this snapshot will read the updated server-side scope on subsequent queries; a forced rebuild may change the share's queryable scope, so existing consumers should be checked first.
Workspace, query, or self-filled permission fields in content.routeQuery do not constitute authorization; when range cannot be safely constructed, a 403 requires regeneration. A relative time of 15m is not equivalent to freezing a specific 15-minute period; when a fixed window is needed, use the absolute millisecond range supported by the page. The main object may be submitted first, and the dashboard summary appended later; a 500 does not prove that nothing was saved, so first check the list by type/name to avoid an unintended overwrite.
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 enter: Obtain an OpenAPI Key with this operation permission from API Key Management in the target Workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| content.routeName | string | Console route identifier, such as Log for Log Explorer or RumHeatMap for Heatmap; keep compatible with the top-level type. Example: LogHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeParams | json | Path parameter object for the corresponding page. Example: {"source": "all"}How to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeParams.source | string | Commonly all for Log Explorer; the specific value is determined by the source page. Example: allHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeParams.自定义键 | any | Dynamic page path parameters; use the configuration generated by the current console page as the basis. Example: valueHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery | json | Query state for the corresponding page; must be an object. Any client-side query value does not expand the authorization already captured by the server. Example: {"w": "wksp_example", "time": "1785423600000,1785427200000", "query": "service:payment", "cols": "time,message,service", "viewType": "view", "index": "default", "snapshotName": "支付服务日志"}How to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.w | string | Page Workspace identifier, usually the current Workspace; this cannot be used to change the API Key scope. Example: wksp_exampleHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.workspaceUUID | string | Comma-separated list of query Workspaces required by the page; still limited by the actual cross-Workspace authorization and the snapshot save scope. Example: wksp_exampleHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.time | string | Page time range, such as 15m or a start-milliseconds,end-milliseconds string; relative time does not physically freeze data. Example: 1785423600000,1785427200000How to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.query | string | Page search query string, for example service:payment in Log Explorer; it is not DQL executed by the snapshot API. Example: service:paymentHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.cols | string | Comma-separated display field names, such as time,message,service. Example: time,message,serviceHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.viewType | string | Common values in Log Explorer are view for list and analyze for analysis; use the actual protocol of the current page. Example: viewHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.index | string | Comma-separated Log Index names, obtained from the Log Index configuration; does not change read permissions. Example: defaultHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.snapshotName | string | Snapshot name displayed on the page; it is recommended to be consistent with the top-level name. Example: 支付服务日志How to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.dashboard_id | string | dsbd_ UUID corresponding to the dashboard snapshot, used for the visibility summary; first verify the resources authorized in the current Workspace. Example: dsbd_exampleHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.app_id | string | Public appId of the RUM heatmap, used to append the application summary. Example: payment_webHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.routeQuery.自定义键 | any | Dynamic states such as page filters/layout; the backend mainly saves them without validating renderability. Example: valueHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| content.自定义键 | any | Other saved states for the corresponding page; they do not mean the client can inject server-side permissions. Example: valueHow to obtain or enter: Obtain from the corresponding source page or the content of an existing snapshot; Workspace/resource IDs must first be checked against the current access authorization. |
|
| name | string | Y | Required string. The current declaration does not enforce non-empty/max length; the entity is 128 characters, and 1–128 is recommended. A record with the same Workspace, type, and name will match the overwrite check; it is not uniformly unique across all types in the entire Workspace. Allows null: False Example: 支付服务日志How to obtain or enter: The caller selects a recognizable name and can check existing snapshots of the same type for duplicate names. |
| type | string | Y | Required string. The save side has no fixed enumeration, but the frontend must support the page type before it can be opened. Do not assume it is renderable just because an arbitrary new type was saved successfully. Allows null: False Example: LogHow to obtain or enter: Obtain from the source console page snapshot configuration or the type of an existing snapshot for the same page; Log is commonly used for Log Explorer. |
| filterType | string | Optional string. Omit or leave empty on creation; entity length is 64 characters. When forcibly overwriting an existing object with the same name and type, this field is ignored and the old value is retained. Allows null: False Example: How to obtain or enter: Obtain from the snapshot filter category on the source page; it can be omitted. |
|
| content | json | Y | Required JSON object. Saves the page configuration/query conditions rather than exported data; dynamic subfields of the object are not fully validated. routeQuery/routeParams must be objects; an incorrect shape can cause a 500 when reading/sharing after saving. It overwrites the content of an existing same-name snapshot as a whole; roles/rules/deniedNamespaces in the client's content/meta do not expand server-side permissions. Allows null: False Example: {"routeName": "Log", "routeParams": {"source": "all"}, "routeQuery": {"w": "wksp_example", "time": "1785423600000,1785427200000", "query": "service:payment", "cols": "time,message,service", "viewType": "view", "index": "default", "snapshotName": "支付服务日志"}}How to obtain or enter: Obtain the route/filter state from the corresponding page in the current console, or construct it using the content of an existing snapshot as a template. |
| isForce | boolean | Optional boolean; omit for false. With the same Workspace, type, and name, false returns 400; true reuses the original uuid, overwrites content, accountUUID, query authorization scope, and isPublic, and refreshes createAt/updateAt, while retaining the original name/type/filterType/creator. It may overwrite a same-name configuration created by someone else; the caller should first check the target and the sharing impact. Allows null: False Example: falseHow to obtain or enter: Set to true only after confirming that a snapshot with the same name and type is to be rebuilt; first save a backup of the old content and scope. |
Additional Parameter Notes¶
A snapshot saves the page configuration and server-side query scope; internet sharing requires creating a separate share configuration. snap_, share_, the first-hop code, and the second-stage token are different identifiers.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/snapshots/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"支付服务日志","type":"Log","content":{"routeName":"Log","routeParams":{"source":"all"},"routeQuery":{"w":"wksp_example","time":"1785423600000,1785427200000","query":"service:payment","cols":"time,message,service","viewType":"view","index":"default","snapshotName":"支付服务日志"}},"isForce":false}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | object | Saved snapshot entity and optional associated summary. |
| content.id | integer or null | Database row ID, not used for path location; it may be null before the snapshot is submitted. |
| content.uuid | string | Snapshot UUID with the snap_ prefix. |
| content.status | integer | Resource status, usually 0; soft-deleted 3 is excluded from queries. |
| content.creator | string | UUID of the original creating principal; a forced overwrite does not necessarily change creator. For the current permission holder, see accountUUID. |
| content.updator | string | Principal of the most recent overwrite/deletion update. |
| content.createAt | number | Unix-second creation/regeneration time; forced overwrite uses time.time(), so the response may contain decimals. |
| content.updateAt | integer | Unix-second update time; -1 if not updated. |
| content.deleteAt | integer | Unix-second deletion time; usually -1 if not deleted. |
| content.workspaceUUID | string | Workspace to which the current Key belongs. |
| content.name | string | Snapshot name; matched uniquely by Workspace and type. |
| content.type | string | Page snapshot kind, such as Log; the save side has no public enumeration validation. |
| content.filterType | string | Saved filter category; omitted/empty on creation; this field is not updated when forcibly overwriting the same name. |
| content.isPublic | integer | 1 for public display within the Workspace, 0 for private; this is not an internet public share. For this public creation, the default is fixed at 1 and the isPublic parameter is not accepted. |
| content.isHidden | integer | Hidden flag; 0 can be listed in this list, while hidden report snapshots are not listed. |
| content.accountUUID | string | UUID of the principal whose permissions were collected at generation/most recent forced overwrite; may differ from creator. |
| content.content | object | Saved page/query configuration, not a copy of real telemetry data; dynamic fields are interpreted according to the corresponding page protocol. |
| content.content.routeName | string | Console route identifier, such as Log for Log Explorer or RumHeatMap for Heatmap; keep compatible with the top-level type. |
| content.content.routeParams | object | Path parameter object for the corresponding page. |
| content.content.routeParams.source | string | Commonly all for Log Explorer; the specific value is determined by the source page. |
| content.content.routeParams.其他键 | JSON | Dynamic page path parameters; use the configuration generated by the current console page as the basis. |
| content.content.routeQuery | object | Query state for the corresponding page; must be an object. Any client-side query value does not expand the authorization already captured by the server. |
| content.content.routeQuery.w | string | Page Workspace identifier, usually the current Workspace; this cannot be used to change the API Key scope. |
| content.content.routeQuery.workspaceUUID | string | Comma-separated list of query Workspaces required by the page; still limited by the actual cross-Workspace authorization and the snapshot save scope. |
| content.content.routeQuery.time | string | Page time range, such as 15m or a start-milliseconds,end-milliseconds string; relative time does not physically freeze data. |
| content.content.routeQuery.query | string | Page search query string, for example service:payment in Log Explorer; it is not DQL executed by the snapshot API. |
| content.content.routeQuery.cols | string | Comma-separated display field names, such as time,message,service. |
| content.content.routeQuery.viewType | string | Common values in Log Explorer are view for list and analyze for analysis; use the actual protocol of the current page. |
| content.content.routeQuery.index | string | Comma-separated Log Index names, obtained from the Log Index configuration; does not change read permissions. |
| content.content.routeQuery.snapshotName | string | Snapshot name displayed on the page; it is recommended to be consistent with the top-level name. |
| content.content.routeQuery.dashboard_id | string | dsbd_ UUID corresponding to the dashboard snapshot, used for the visibility summary; first verify the resources authorized in the current Workspace. |
| content.content.routeQuery.app_id | string | Public appId of the RUM heatmap, used to append the application summary. |
| content.content.routeQuery.status | integer | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Page status submitted by the caller. |
| content.content.routeQuery.jsonContent | object | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Application configuration submitted by the caller. |
| content.content.routeQuery.jsonContent.name | string | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Application name. |
| content.content.routeQuery.jsonContent.type | string | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Application platform type. |
| content.content.routeQuery.jsonContent.extend | object | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Optional application extension. |
| content.content.routeQuery.jsonContent.extend.自定义键 | JSON | Echo of the page configuration submitted this time; may be omitted. The create response does not automatically add additional RUM list information. Extended value saved for the application. |
| content.content.routeQuery.其他键 | JSON | Dynamic states such as page filters/layout; the backend mainly saves them without validating renderability. |
| content.content.其他键 | JSON | Other saved states for the corresponding page; they do not mean the client can inject server-side permissions. |
| content.rules | object or null | Query permission/masking snapshot collected by the server; read-only. Clients must not pass rules or forge them in content to gain permissions. Historical formats may differ. |
| content.rules.eventScopeVersion | integer | Event scope version 1 for new authorization; old snapshots may not have this key, and certain queries will require regeneration. |
| content.rules.ruleContextVersion | integer | 2 for the new format; the old format may be 1 or omitted. |
| content.rules.roles | array<string> |
Role identifiers of the actual calling identity at save time; not a writable role selection. |
| content.rules.roles[] | string | A single server-confirmed role ID. |
| content.rules.deniedNamespaces | array<string> |
Denied query scopes, such as logging/rum/tracing/metric/lineage/keyevent; the actual values are based on the namespaces known to the site. |
| content.rules.deniedNamespaces[] | string | A single denied data scope. |
| content.rules.rules | object | namespace → array of captured data access rules. |
| content.rules.rules.命名空间 | array<object> |
Rules for this scope; an empty array cannot replace query permissions. |
| content.rules.rules.命名空间[].rule_uuid | string | UUID of the original access rule. |
| content.rules.rules.命名空间[].region_code | string | Site identifier where the rule resides. |
| content.rules.rules.命名空间[].rule_info | object | Access condition content, interpreted according to the data scope. |
| content.rules.rules.命名空间[].rule_info.sources | array<string> |
Allowed sources for scopes such as lineage/keyevent, according to the original rule protocol. |
| content.rules.rules.命名空间[].rule_info.sources[] | string | A single original rule source, not a new client authorization. |
| content.rules.rules.命名空间[].rule_info.rule | string | Filter expression of the original rule. |
| content.rules.rules.命名空间[].rule_info.其他键 | JSON | Other fields of the original data rule for this scope. |
| content.rules.rules.命名空间[].rule_mask_info | object | Optional masking information included with the original data access rule. |
| content.rules.rules.命名空间[].rule_mask_info.maskFields | string | Comma-separated fields. |
| content.rules.rules.命名空间[].rule_mask_info.reExprs | array<object> |
Regular expression configuration. |
| content.rules.rules.命名空间[].rule_mask_info.reExprs[].reExpr | string | Masking regular expression. |
| content.rules.rules.命名空间[].其他键 | JSON | Reserved fields of the original access rule, not new execution parameters of this API. |
| content.rules.sensitiveDataMaskRules | object | namespace → array of sensitive field rules (historical empty objects are compatible). |
| content.rules.sensitiveDataMaskRules.命名空间 | array or object | In the new format, a non-empty value should be an array of rule objects; an empty object is compatible with no rules. |
| content.rules.sensitiveDataMaskRules.命名空间[].fields | array<string> |
List of original sensitive fields. |
| content.rules.sensitiveDataMaskRules.命名空间[].fields[] | string | Field name. |
| content.rules.sensitiveDataMaskRules.命名空间[].reExpr | string or null | Masking regular expression for the original sensitive data. |
| content.rules.sensitiveDataMaskRules.命名空间[].其他键 | JSON | Other fields of the original rule. |
| content.dashboardIsPublic | integer or boolean | Optional visibility hint for the associated dashboard, which may be appended only when an associated dashboard exists; it does not equal snapshot sharing permission. |
| content.declaration | object or null | Workspace public declaration for a non-empty business object; when not configured, it may be null or an empty object; it is not appended for an empty business object. |
{
"code": 200,
"content": {
"id": null,
"uuid": "snap_example",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"workspaceUUID": "wksp_example",
"name": "支付服务日志",
"type": "Log",
"filterType": "",
"isPublic": 1,
"isHidden": 0,
"accountUUID": "wsak_example",
"content": {
"routeName": "Log",
"routeParams": {
"source": "all"
},
"routeQuery": {
"w": "wksp_example",
"time": "1785423600000,1785427200000",
"query": "service:payment",
"cols": "time,message,service",
"viewType": "view",
"index": "default",
"snapshotName": "支付服务日志"
}
},
"rules": {
"eventScopeVersion": 1,
"ruleContextVersion": 2,
"roles": [
"wsAdmin"
],
"rules": {},
"sensitiveDataMaskRules": {},
"deniedNamespaces": []
},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field missing, or field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The top level of the request JSON is not an object | JSON file format error in some parts | Submit snapshot parameters containing a content object. |
| 400 | ft.SnapshotRepeatNames | A record with the same type and name exists in the Workspace and isForce is not enabled | Snapshot name already exists | First query the target, and set isForce=true explicitly only after confirming the overwrite impact. |
| 403 | ft.SnapshotQueryScopeUnavailable | The current server-side authorization/rule context cannot be safely captured or verified | The share access scope is incomplete or this query is not allowed; ask the sharer to regenerate | The administrator should check the current Key's query permissions/rules and regenerate using a valid identity with the target scope; do not inject permission bypasses in content. |
| 401 | ft.WKSPNotExistOrReleased | Failed to read the current active Workspace during creation | Workspace does not exist or has been released | Check whether the Key's Workspace is still active. |
| 500 | ft.InternalServerError | Unhandled exceptions such as reading/writing snapshot/permission rules, associating a dashboard summary after saving, or committing context | Internal error | First read the snapshot by type/name to check the saved content/authorization scope, avoid blind isForce overwrites, and retain traceId for troubleshooting. |