Method: children.insert
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Żądanie HTTP
POST https://www.googleapis.com/drive/v2/files/{folderId}/children
Adres URL używa składni transkodowania gRPC.
Parametry ścieżki
Parametry |
folderId |
string
Identyfikator folderu.
|
Parametry zapytania
Parametry |
enforceSingleParent (deprecated) |
boolean
Nieaktualne: dodawanie plików do wielu folderów nie jest już obsługiwane. Zamiast tego użyj shortcuts .
|
supportsAllDrives |
boolean
Czy aplikacja przesyłająca żądanie obsługuje zarówno Mój Dysk, jak i dyski współdzielone.
|
supportsTeamDrives (deprecated) |
boolean
Wycofane: użyj w zastępstwie tego supportsAllDrives .
|
Treść żądania
Treść żądania zawiera wystąpienie elementu ChildReference
.
Treść odpowiedzi
Jeśli operacja się powiedzie, treść odpowiedzi będzie zawierała nowo utworzoną instancję ChildReference
.
Zakresy autoryzacji
Wymaga jednego z tych zakresów OAuth:
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
Niektóre zakresy są ograniczone i wymagają oceny bezpieczeństwa, aby aplikacja mogła z nich korzystać. Więcej informacji znajdziesz w przewodniku dotyczącym autoryzacji.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[],[],null,["# Method: children.insert\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nInserts a file into a folder.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v2/files/{folderId}/children`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|--------------------------------|\n| `folderId` | `string` The ID of the folder. |\n\n### Query parameters\n\n| Parameters ||\n|----------------------------------------|---------------------------------------------------------------------------------------------------------|\n| `enforceSingleParent` **(deprecated)** | `boolean` Deprecated: Adding files to multiple folders is no longer supported. Use `shortcuts` instead. |\n| `supportsAllDrives` | `boolean` Whether the requesting application supports both My Drives and shared drives. |\n| `supportsTeamDrives` **(deprecated)** | `boolean` Deprecated: Use `supportsAllDrives` instead. |\n\n### Request body\n\nThe request body contains an instance of [ChildReference](/workspace/drive/api/reference/rest/v2/children#ChildReference).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [ChildReference](/workspace/drive/api/reference/rest/v2/children#ChildReference).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\n- `\n https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.appdata`\n- `\n https://www.googleapis.com/auth/drive.file`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]