Notizen und Anhänge abrufen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Das folgende Beispiel zeigt, wie eine Notiz und ihr Anhang abgerufen werden:
REST
Rufen Sie media.download() mit dem Namen des Anhangdownloads und dem URL-Parameter alt=media auf.
Der URL-Parameter alt=media teilt dem Server mit, dass ein Download von Inhalten angefordert wird.
Wenn Sie den Namen des Anhangs abrufen möchten, müssen Sie zuerst die Notiz abrufen.
Java
/** * Gets and downloads the attachment of a note. * * @param note The note whose attachment will be downloaded. * @throws IOException */privatevoidgetNoteAttachment(Notenote)throwsIOException{// First call is to get the attachment resources on the note.List<Attachment>attachments=keepService.notes().get(note.getName()).execute().getAttachments();if(!attachments.isEmpty()){Attachmentattachment=attachments.get(0);StringmimeType=attachment.getMimeType().get(0);// Make a second call to download the attachment with the specified// mimeType.OutputStreamoutputStream=newFileOutputStream("attachmentFile."+mimeType.split("/")[1]);keepService.media().download(attachment.getName()).setMimeType(mimeType).executeMediaAndDownloadTo(outputStream);}}
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2026-01-23 (UTC)."],[],[]]