Custom Metadata using Application Data

Embedding Knowledge in Evernote Notes


There are times when it’s useful to add application-specific metadata and other information to Evernote notes. We provide applicationData—part of the NoteAttributes data structure—for exactly this purpose.

Each note is given this 4kb map of arbitrary data, shared by all third-party applications. All you need is the GUID of the note whose data you’d like to examine or modify. Each third-party application is allowed one entry in the map. The developer should use their application’s consumer key as the map key.

Additionally, the Evernote API provides shortcut functions for accessing and modifying applicationData, so it’s simple to use:

Sample code

The following sample creates a new note, saves it to the Evernote service (which sets the Note.guid field) and adds an entry to the note’s applicationData. Finally, the changes are saved to the Evernote service using NoteStore.updateNote:

NoteStore.getNoteApplicationDataEntry and NoteStore.unsetNoteApplicationDataEntry work as advertised; pass the note GUID and your application’s Consumer Key as parameters.

Troubleshooting

Since applicationData is of limited size and is available to all third-party developers, it’s possible that adding new data may cause the field's value to exceed the the 4kb limit. In this case, an instance of EDAMUserException is thrown with the BAD_DATA_FORMAT error code. When you encounter this error, do not retry the operation as it will continue to fail until a portion of applicationData large enough to house your data becomes available. We do not make any effort to police how much of applicationData is used by each third-party application, so it’s possible that a given note will perpetually lack available space for your data.

Best Practices

Remember that applicationData is a shared resource; keep your values as small as possible to avoid rendering the resource unusable by other applications.

Stay on top of what's happening in the Evernote developer community.