Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Kirim masukan
Mengambil catatan dan lampiran
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Contoh berikut menunjukkan cara mengambil catatan dan lampirannya:
REST Panggil
media.download
dengan nama download lampiran dan parameter URL alt=media.
Parameter URL alt=media memberi tahu server bahwa download konten sedang diminta.
Untuk mendapatkan nama lampiran, Anda harus terlebih dahulu mengambil catatan .
Catatan: Parameter URL alt=media adalah
parameter sistem
yang tersedia di semua Google REST API. Jika Anda menggunakan library klien untuk Google Keep API, Anda tidak perlu menetapkan parameter ini secara eksplisit.
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 );
}
}
Kirim masukan
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0 , sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0 . Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers . Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2026-05-13 UTC.
Ada masukan untuk kami?
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2026-05-13 UTC."],[],[]]