Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Prześlij opinię
Pobieranie notatek i załączników
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Poniższy przykład pokazuje, jak pobrać notatkę i jej załącznik:
REST Wywołaj funkcję
media.download
z nazwą pobranego załącznika i parametrem adresu URL alt=media.
Parametr adresu URL alt=media informuje serwer, że żądane jest pobranie treści.
Aby uzyskać nazwę załącznika, musisz najpierw pobrać notatkę .
Uwaga: parametr adresu URL alt=media jest parametrem systemowym dostępnym we wszystkich interfejsach API REST Google. Jeśli używasz biblioteki klienta interfejsu Google Keep API, nie musisz jawnie ustawiać tego parametru.
Java
/**
* Gets and downloads the attachment of a note.
*
* @param note The note whose attachment will be downloaded.
* @throws IOException
*/
private void getNoteAttachment ( Note note ) throws IOException {
// First call is to get the attachment resources on the note.
List<Attachment> attachments =
keepService . notes (). get ( note . getName ()). execute (). getAttachments ();
if ( ! attachments . isEmpty ()) {
Attachment attachment = attachments . get ( 0 );
String mimeType = attachment . getMimeType (). get ( 0 );
// Make a second call to download the attachment with the specified
// mimeType.
OutputStream outputStream =
new FileOutputStream ( "attachmentFile." + mimeType . split ( "/" ) [ 1 ] );
keepService
. media ()
. download ( attachment . getName ())
. setMimeType ( mimeType )
. executeMediaAndDownloadTo ( outputStream );
}
}
Prześlij opinię
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: 2026-05-13 UTC.
Chcesz przekazać coś jeszcze?
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2026-05-13 UTC."],[],[]]