Zum Inhalt
Für Agenten

drive_file_save

Update, Rename or Move File

Markdown Tools als JSON

Beschreibung

Renames a file (name) and/or moves it into another folder within the same drive (folder_id, null moves to root). To replace content while preserving the file ID, upload the new bytes with attachment_upload, then pass attachment_id and base_version from the last drive_file_content or drive_file_get read. A stale base_version returns version_conflict without changing the file; re-read the current file and merge your edits before retrying. Previous content is retained in file history and changes sync to Macs.

Cross-drive moves are not supported (validation would reject them). Access: DriveFilePolicy#update? — editor or higher.

Zugriff

Zugriffsprofil: gated. Module: files. Die Freigabe im Profil ersetzt keine Account-, Workspace- oder Rollenberechtigung.

Parameter

Name Typ Pflicht Beschreibung
account_id string Ja
id string Ja File prefix ID (dfi_…).
name string Nein
folder_id string / null Nein Destination folder (dfo_…) in the SAME drive. Pass null to move to root.
attachment_id string Nein att_… ID or file_url from attachment_upload with replacement bytes.
base_version integer Nein Last-read sync_version. Required when replacing content; also accepted for rename/move.

Eingabeschema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "account_id": {
      "type": "string"
    },
    "id": {
      "type": "string",
      "description": "File prefix ID (dfi_…)."
    },
    "name": {
      "type": "string",
      "maxLength": 255
    },
    "folder_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Destination folder (dfo_…) in the SAME drive. Pass null to move to root."
    },
    "attachment_id": {
      "type": "string",
      "description": "att_… ID or file_url from attachment_upload with replacement bytes."
    },
    "base_version": {
      "type": "integer",
      "minimum": 0,
      "description": "Last-read sync_version. Required when replacing content; also accepted for rename/move."
    }
  },
  "required": [
    "account_id",
    "id"
  ],
  "type": "object"
}

Ausgabeschema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "folder_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "drive_id": {
      "type": "string"
    },
    "sync_version": {
      "type": "integer"
    }
  },
  "required": [
    "id",
    "name",
    "folder_id",
    "drive_id",
    "sync_version"
  ],
  "type": "object"
}
Seiten