Skip to content

Import



POST /api/v1/notes/{notes_uuid}/import

Overview

Rebuild the chart content in the specified legacy note by using a template.

Before Calling and Usage Steps

First, back up the target note using Export Note. Pass the complete template to templateInfo. The note UUID in the path is retained, charts referenced by the original pos are soft-deleted, and new UUIDs are generated for imported charts. If templateInfo or main.charts is missing, a successful execution clears the charts; if extend is missing, it is overwritten with {}. Validate the template first, and after completion use Note Details to verify the charts and name.

Path Parameters

Parameter Type Required Description
notes_uuid string Y UUID of the target legacy note.
Example: note_example
How to get or fill in: Obtain it from content.data[].uuid in Note List, or use content.uuid from the creation response.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to get or fill in: Obtain an OpenAPI Key with permission for this operation from API Key Management in the target workspace.

Body Parameters

Parameter Type Required Description
templateInfo.name string If non-empty, overrides the current note name. If omitted or an empty string, the current name is retained.
Example: 生产巡检笔记
How to get or fill in: Take the value from name in the exported template, and rename it as needed.
templateInfo.extend object Extension object for the note; if omitted, it is overwritten with {}.
Example: {}
How to get or fill in: Get it from extend in the exported template.
templateInfo.main object Main content body; if missing, existing charts are cleared.
Example: {"charts": [{"name": "巡检说明", "type": "text", "queries": [{"query": {"content": "按仪表板核对生产状态。"}}], "extend": {}}]}
How to get or fill in: Get it from main in the exported template.
templateInfo.main.charts array Complete list of charts to import. If missing or set to [], the charts are cleared.
Example: [{"name": "巡检说明", "type": "text", "queries": [{"query": {"content": "按仪表板核对生产状态。"}}], "extend": {}}]
How to get or fill in: Use the complete chart array from main.charts and determine the order.
templateInfo.main.charts[].name string Chart name, up to 256 characters. If omitted, defaults to an empty string.
Example: 巡检说明
How to get or fill in: Use the name of the exported chart, or enter a new name.
templateInfo.main.charts[].type string Chart type. If omitted, line is used.
Example: text
How to get or fill in: Prefer to use the type of the exported chart. For a text body example, use text.
templateInfo.main.charts[].queries array Chart queries or body definition. If omitted, defaults to [].
Example: [{"query": {"content": "按仪表板核对生产状态。"}}]
How to get or fill in: Copy the original queries from a chart of the same type.
templateInfo.main.charts[].queries[].query.content string Content field in the text chart body example.
Example: 按仪表板核对生产状态。
How to get or fill in: For text charts, enter the body to display. For other types, use the exported content.
templateInfo.main.charts[].extend object Extension configuration. If omitted, it is {}.
Example: {}
How to get or fill in: Use the extend settings from the exported chart.
templateInfo json Template object to import. When name is non-empty, it can override the note name. Be sure to submit the complete template.
Allows null: False
Example: {"name": "生产巡检笔记", "extend": {}, "main": {"charts": [{"name": "巡检说明", "type": "text", "queries": [{"query": {"content": "按仪表板核对生产状态。"}}], "extend": {}}]}}
How to get or fill in: Obtain the content containing main.charts from Export Note. Make sure the chart order and parameters in the template are correct.

Additional Parameter Notes

This operation overwrites the original charts. The template format uses the JSON obtained from the export API; replace the name and chart content as needed.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/notes/note_example/import' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"templateInfo":{"name":"生产巡检笔记","extend":{},"main":{"charts":[{"name":"巡检说明","type":"text","queries":[{"query":{"content":"按仪表板核对生产状态。"}}],"extend":{}}]}}}'

Response

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

Field Type Description
content.id integer Note record ID.
content.uuid string Note UUID, used for querying, modifying, importing, and deleting.
content.name string Note name.
content.workspaceUUID string Workspace it belongs to.
content.isPublic integer Visibility. 1 is public, 0 is creator identity only.
content.extend object Note extension configuration.
content.status integer Current status of the note.
content.creator string Creator identity ID.
content.updator string Identity ID of the last updater; can be empty if never updated.
content.createAt number Creation time, Unix seconds.
content.updateAt number Last update time, Unix seconds. Can be -1 if never updated.
content.deleteAt number Deletion time, Unix seconds. -1 if not deleted.
content.pos array<object> Ordered reference array of charts.
content.pos[].chartUUID string Chart UUID.
content.declaration object or null Public declaration of the workspace.
{
  "code": 200,
  "content": {
    "id": 11,
    "uuid": "note_example",
    "name": "生产巡检笔记",
    "workspaceUUID": "wksp_example",
    "isPublic": 1,
    "pos": [
      {
        "chartUUID": "chrt_example"
      }
    ],
    "extend": {},
    "status": 0,
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": -1,
    "deleteAt": -1,
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

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

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed templateInfo is null, has an incorrect type, or contains undeclared top-level request fields Parameter parsing failed Submit the object according to the request parameter table, and use the complete template returned by the export API.
400 ft.RequestJsonFormatError Invalid request JSON syntax Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError JSON syntax is valid but the top level of the request is not an object Some JSON file format error Put the parameters into a JSON object and try again.
404 ft.NotFoundNote The UUID has been deleted, does not exist, or is not in the workspace of the current API Key Specified note not found Verify the UUID using the note list in the same workspace.
403 ft.ForbiddenFreeEditionLimit The workspace has the corresponding quota enabled and the number of legacy notes has reached the upper limit Free Plan workspace {} has reached the upper limit ({}), so new notes cannot be created. Activate the Commercial Plan to unlock the limit Verify the workspace plan and note count, then adjust the quota or resources.
406 ft.ExceedMaxCharacterLimit The chart name in the template exceeds the supported length {} exceeds the maximum character length limit Change the chart name to no more than 256 characters, then verify the template and backup.

Feedback

Is this page helpful?