Kaiken, minkä Driven näkymät tekevät tiedostoillesi, voi tehdä koodista. Jokaisella toiminnolla on metodi, jonka nimi päättyy _user, mikä tarkoittaa aina oman tilisi Drivea. Samat toiminnot löytyvät päätteillä _workspace ja _studio työtilan Drivelle ja Studion rakennustiedostoille: ne ovat muita pintoja, ja koko lista on lopussa.
Jokainen kutsu on POST osoitteeseen /cpi/<method>, ja JSON-runko sisältää API-avaimesi:
curl -X POST https://xuda.ai/cpi/get_drive_files_user \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_API_KEY","path":"/","sort_by":"date","sort_dir":"desc"}'
Vastaus on pyytämäsi polun kansiot ja tiedostot. Tiedosto tai kansio nimetään sen file_path-arvolla ja type-arvolla, joka on file tai directory.
Mitä kukin näkymä tekee kutsuna
| Drivessa | Metodi |
|---|---|
| Kansion avaus, haku, Tähdellä merkityt, Viimeisimmät | get_drive_files_user: path on pakollinen. search_string, tags, sort_by, sort_dir, starred ja recent rajaavat ja järjestävät. |
| Jaettu kanssani | get_shared_with_me_files_user |
| Tiedoston lataus | upload_drive_file_user |
| Samannimisen tiedoston tarkistus ennen latausta | check_drive_file_user ja check_drive_files_user |
| Uusi kansio | create_drive_folder_user: path ja folder_name. |
| Nimeä uudelleen | rename_drive_file_user kentillä file_path ja file_name_to sekä rename_drive_folder_user kentillä curr_path ja new_path. |
| Siirrä… ja leikatun Liitä | move_drive_files_user: files_arr ja dest_path. |
| Kopioi ja Liitä | copy_drive_files_user: files_arr ja dest_path. |
| Lisää tähdellisiin | star_drive_file_user: type, file_path ja starred. |
| Tunnisteet | update_drive_file_tags_user: type, file_path ja tags. |
| Julkinen tiedosto | update_drive_file_sharing_mode_user: is_public. |
| Tiedot | get_drive_file_info_user |
| Pura | extract_drive_file_user |
| Siirrä roskakoriin | trash_drive_files_user: files_arr muodossa { "type", "file_path" }. |
| Roskakori, Palauta, Poista pysyvästi | get_trashed_files_user, restore_trashed_files_user ja purge_trashed_files_user. Kaksi viimeistä ottavat trash_roots-arvon, eli roskakorilistan antamat tunnukset. |
| Tallennustila-ikkuna | get_drive_size_user käytetyille tavuille ja get_drive_breakdown_user tyyppijakaumalle ja kaksoiskappaleille. |
| Tiedoston versiot | get_drive_file_versions_user listaa ne uusin ensin, ja keep_drive_file_version_user säilyttää sen, mitä tiedosto sisältää nyt, versiona ennen kuin kirjoitat siihen uuden. |
Roskakoriin siirto on pehmeä poisto. Tiedosto palaa metodilla restore_trashed_files_user, kunnes se tyhjennetään lopullisesti. delete_drive_files_user poistaa pysyvästi kulkematta Roskakorin kautta.
Työskentely sinulle jaetun kohteen sisällä
Useimmat _user-metodit ottavat valinnaisen share_id-arvon. Anna Jaettu kanssani -rivin share_id, niin kutsu toimii jakajan Drivessa jaon antamallasi tasolla, vain jaetulla kohteella tai jaetun kansion sisällä: Luku listaa ja avaa, Luku ja kirjoitus myös nimeää uudelleen, lataa ja siirtää sen sisällä, ja Ylläpito myös siirtää roskakoriin, poistaa ja tekee julkiseksi.
Jakaminen
Se, kenelle tiedosto on jaettu, ei ole Drive-metodi. Tiedoston jakoikkuna kutsuu metodeja create_share ja get_shares siten, että access_type on user_drive ja share_item_id on tiedoston polku. share_level on read, readwrite tai admin.
Kaikki Drive-metodit
check_drive_file_studioCheck Drive File StudioCheck Drive File StudioChecks whether a file or folder already exists in the studio drive.4 fieldsadmincheck_drive_file_userCheck Drive File UserCheck Drive File UserChecks whether a file or folder already exists in the user drive.4 fieldsusercheck_drive_file_workspaceCheck Drive File WorkspaceCheck Drive File WorkspaceChecks whether a file or folder already exists in the workspace drive.4 fieldsadmincheck_drive_files_studioCheck Drive Files StudioCheck Drive Files StudioChecks whether multiple files or folders already exist in the studio drive.5 fieldsadmincheck_drive_files_userCheck Drive Files UserCheck Drive Files UserChecks whether multiple files or folders already exist in the user drive.5 fieldsusercheck_drive_files_workspaceCheck Drive Files WorkspaceCheck Drive Files WorkspaceChecks whether multiple files or folders already exist in the workspace drive.5 fieldsadmincopy_drive_files_userCopy Drive Files UserCopy Drive Files UserCopies drive files/folders (with their full subtree, duplicating the stored bytes) into another folder in the user drive.3 fieldsusercopy_drive_files_workspaceCopy Drive Files WorkspaceCopy Drive Files WorkspaceCopies drive files/folders (with their full subtree, duplicating the stored bytes) into another folder in the workspace drive.3 fieldsadmincreate_drive_folder_studioCreate Drive Folder StudioCreate Drive Folder StudioCreates drive folder for studio drive.5 fieldsadmincreate_drive_folder_userCreate Drive Folder UserCreate Drive Folder UserCreates drive folder for user drive.5 fieldsusercreate_drive_folder_workspaceCreate Drive Folder WorkspaceCreate Drive Folder WorkspaceCreates drive folder for workspace drive.5 fieldsadmindelete_drive_files_studioDelete Drive Files StudioDelete Drive Files StudioDeletes drive files from studio drive.2 fieldsadmindelete_drive_files_userDelete Drive Files UserDelete Drive Files UserDeletes drive files from user drive.3 fieldsuserdelete_drive_files_workspaceDelete Drive Files WorkspaceDelete Drive Files WorkspaceDeletes drive files from workspace drive.2 fieldsadmindelete_file_bulk_studioDelete File Bulk StudioDelete File Bulk StudioDeletes multiple files from the studio drive.2 fieldsadmindelete_file_bulk_userDelete File Bulk UserDelete File Bulk UserDeletes multiple files from the user drive.1 fielduserdelete_file_bulk_workspaceDelete File Bulk WorkspaceDelete File Bulk WorkspaceDeletes multiple files from the workspace drive.2 fieldsadminextract_drive_file_studioExtract Drive File StudioExtract Drive File StudioUnzips an archive file in place: each entry in the archive becomes a new file or folder at the same drive location as the archive.2 fieldsadminextract_drive_file_userExtract Drive File UserExtract Drive File UserUnzips an archive file in place: each entry in the archive becomes a new file or folder at the same drive location as the archive.3 fieldsuserextract_drive_file_workspaceExtract Drive File WorkspaceExtract Drive File WorkspaceUnzips an archive file in place: each entry in the archive becomes a new file or folder at the same drive location as the archive.2 fieldsadminget_drive_breakdown_userGet Drive Breakdown UserGet Drive Breakdown UserStorage breakdown by file type + duplicate groups for the drive. (user drive)No fieldsuserget_drive_breakdown_workspaceGet Drive Breakdown WorkspaceGet Drive Breakdown WorkspaceStorage breakdown by file type + duplicate groups for the drive. (workspace drive)1 fieldadminget_drive_file_info_studioGet Drive File Info StudioGet Drive File Info StudioRetrieves drive file information for studio drive.3 fieldsadminget_drive_file_info_userGet Drive File Info UserGet Drive File Info UserRetrieves drive file information for user drive.4 fieldsuserget_drive_file_info_workspaceGet Drive File Info WorkspaceGet Drive File Info WorkspaceRetrieves drive file information for workspace drive.3 fieldsadminget_drive_file_versions_userGet Drive File Versions UserGet Drive File Versions UserLists a user drive file's versions, newest first: its AI edits and what it held before each Replace, each with its link, out of every listing.2 fieldsuserget_drive_files_studioGet Drive Files StudioGet Drive Files StudioRetrieves drive files for studio drive.12 fieldsadminget_drive_files_userGet Drive Files UserGet Drive Files UserRetrieves drive files for user drive.12 fieldsuserget_drive_files_workspaceGet Drive Files WorkspaceGet Drive Files WorkspaceRetrieves drive files for workspace drive.12 fieldsadminget_drive_size_studioGet Drive Size StudioGet Drive Size StudioReturns the total storage used (bytes) by the studio drive.1 fieldadminget_drive_size_userGet Drive Size UserGet Drive Size UserReturns the total storage used (bytes) by the user drive.No fieldsuserget_drive_size_workspaceGet Drive Size WorkspaceGet Drive Size WorkspaceReturns the total storage used (bytes) by the workspace drive.1 fieldadminget_shared_with_me_files_userGet Shared With Me FilesGet Shared With Me FilesLists drive files and folders shared with the current user.1 fielduserget_trashed_files_userGet Trashed Files UserGet Trashed Files UserLists trashed items (trash roots) for the drive. (user drive)No fieldsuserget_trashed_files_workspaceGet Trashed Files WorkspaceGet Trashed Files WorkspaceLists trashed items (trash roots) for the drive. (workspace drive)1 fieldadminkeep_drive_file_version_userKeep Drive File Version UserKeep Drive File Version UserKeeps what a user drive file holds now as one of its versions (out of every listing), before another version is written into it.2 fieldsusermove_drive_files_userMove Drive Files UserMove Drive Files UserMoves drive files/folders (with their full subtree) into another folder in the user drive.3 fieldsusermove_drive_files_workspaceMove Drive Files WorkspaceMove Drive Files WorkspaceMoves drive files/folders (with their full subtree) into another folder in the workspace drive.3 fieldsadminpurge_trashed_files_userPurge Trashed Files UserPurge Trashed Files UserPermanently deletes trashed batches (docs tombstoned, bytes cleaned). (user drive)1 fielduserpurge_trashed_files_workspacePurge Trashed Files WorkspacePurge Trashed Files WorkspacePermanently deletes trashed batches (docs tombstoned, bytes cleaned). (workspace drive)2 fieldsadminrename_drive_file_studioRename Drive File StudioRename Drive File StudioRenames drive file in studio drive.3 fieldsadminrename_drive_file_userRename Drive File UserRename Drive File UserRenames drive file in user drive.3 fieldsuserrename_drive_file_workspaceRename Drive File WorkspaceRename Drive File WorkspaceRenames drive file in workspace drive.3 fieldsadminrename_drive_folder_studioRename Drive Folder StudioRename Drive Folder StudioRenames drive folder in studio drive.3 fieldsadminrename_drive_folder_userRename Drive Folder UserRename Drive Folder UserRenames drive folder in user drive.3 fieldsuserrename_drive_folder_workspaceRename Drive Folder WorkspaceRename Drive Folder WorkspaceRenames drive folder in workspace drive.3 fieldsadminrestore_trashed_files_userRestore Trashed Files UserRestore Trashed Files UserRestores trashed batches back into the drive. (user drive)1 fielduserrestore_trashed_files_workspaceRestore Trashed Files WorkspaceRestore Trashed Files WorkspaceRestores trashed batches back into the drive. (workspace drive)2 fieldsadminstar_drive_file_studioStar Drive File StudioStar Drive File StudioToggles the starred bookmark on a studio drive item.4 fieldsadminstar_drive_file_userStar Drive File UserStar Drive File UserToggles the starred bookmark on a user drive item.3 fieldsuserstar_drive_file_workspaceStar Drive File WorkspaceStar Drive File WorkspaceToggles the starred bookmark on a workspace drive item.4 fieldsadmintrash_drive_files_userTrash Drive Files UserTrash Drive Files UserMoves drive items (with their subtree) to the trash: soft delete, restorable. (user drive)2 fieldsusertrash_drive_files_workspaceTrash Drive Files WorkspaceTrash Drive Files WorkspaceMoves drive items (with their subtree) to the trash: soft delete, restorable. (workspace drive)2 fieldsadminupdate_drive_addons_studioUpdate Drive Addons StudioUpdate Drive Addons StudioUpdates drive addons for studio drive.5 fieldsadminupdate_drive_addons_userUpdate Drive Addons UserUpdate Drive Addons UserUpdates the drive addon toggles (OCR, image convertor, video AI, AI component generator, edit image) on the user's account drive.4 fieldsuserupdate_drive_addons_workspaceUpdate Drive Addons WorkspaceUpdate Drive Addons WorkspaceUpdates drive addons for workspace drive.5 fieldsadminupdate_drive_file_sharing_mode_studioUpdate Drive File Sharing Mode StudioUpdate Drive File Sharing Mode StudioUpdates drive file sharing mode for studio drive.4 fieldsadminupdate_drive_file_sharing_mode_userUpdate Drive File Sharing Mode UserUpdate Drive File Sharing Mode UserUpdates drive file sharing mode for user drive.4 fieldsuserupdate_drive_file_sharing_mode_workspaceUpdate Drive File Sharing Mode WorkspaceUpdate Drive File Sharing Mode WorkspaceUpdates drive file sharing mode for workspace drive.4 fieldsadminupdate_drive_file_studioUpdate Drive File StudioUpdate Drive File StudioUpdates drive file for studio drive.2 fieldsadminupdate_drive_file_tags_studioUpdate Drive File Tags StudioUpdate Drive File Tags StudioUpdates drive file tags for studio drive.4 fieldsadminupdate_drive_file_tags_userUpdate Drive File Tags UserUpdate Drive File Tags UserUpdates drive file tags for user drive.4 fieldsuserupdate_drive_file_tags_workspaceUpdate Drive File Tags WorkspaceUpdate Drive File Tags WorkspaceUpdates drive file tags for workspace drive.4 fieldsadminupdate_drive_file_userUpdate Drive File UserUpdate Drive File UserUpdates drive file for user drive.2 fieldsuserupdate_drive_file_workspaceUpdate Drive File WorkspaceUpdate Drive File WorkspaceUpdates drive file for workspace drive.2 fieldsadminupload_drive_file_studioUpload Drive File StudioUpload Drive File StudioUploads drive file to studio drive.1 fieldadminupload_drive_file_userUpload Drive File UserUpload Drive File UserUploads drive file to user drive.1 fielduserupload_drive_file_workspaceUpload Drive File WorkspaceUpload Drive File WorkspaceUploads drive file to workspace drive.3 fieldsadmin
Paketit
Latausta ei estetä tilan puutteen takia. Katso Paketit ja laskutus, mikä lasketaan tilaasi ja mitä tapahtuu sen ylittyessä.