Retrieving small versions of data stored in Evernote
The Evernote service can produce thumbnail images for notes and individual resources. Thumbnails are not accessed through the Cloud API. Instead, a HTTP POST request is made to the Evernote service. If no resources are attached to the note (i.e. it is note that contains only text) the thumbnail will be a image of the first few lines of text in the note. To retrieve the thumbnail for a note, use the URL:
- [service] is the name of the Evernote service (either sandbox.evernote.com or www.evernote.com)
- [shardId] is the shard ID where the note is stored
- [noteGuid] is the GUID of the note that is being linked to
To retrieve a thumbnail for a single resource, use the URL:
Where [resourceGuid] is the GUID of the resource you wish to retrive the thumbnail of.
Thumbnail Image Type and Size
Thumbnails will be of type PNG, JPEG, or GIF (as indicated by the response "Content-Type" header). You can specify the image format that you want by appending .jpg, .gif, .bmp or .png to the GUID.
Thubmnails will fit within a 300 by 300 pixel square without requiring you to crop or scale them manually. One or both dimensions of an image may be less than the size of the box, so the image should be centered with an appropriate background and/or frame. You can request a smaller thumbnail by passing the size POST parameter with a value from 1 to 299, indicating the desired size of the bounding box in pixels. The server will return an image that will fit within this box, but one or both dimensions may be less than the requested value. The image will look best if the size is an even multiple of 300, such as 150 or 75.
The following examples access thumbnails for an Evernote account on shard s1 of sandbox.evernote.com. Note that no authentication is required for these examples because the are in a public notebook, and that we're using GET instead of POST to simplify the example.
Get a full-size thumbnail for the note with the GUID e669c090-d8b2-4324-9eae-56bd31c64af7:
Get a 75x75 thumbnail for the same note in JPEG format:
Get a full-size thumbnail for an image resource with GUID 8528dddd-1d71-4e4d-9006-377be7517dfb:
Here's how the authenticated POST request might look in the real world:
Note the inclusion of the
auth POST parameter; this valid authentication token—a developer token would also work here—must be included if the requested note or resource is not shared publicly. Again, for public notes and notebooks, the
auth parameter is not required and should be omitted.
The following is a fully working example that writes all the thumbnails of the notes in a specified notebook to the current directory using Python, Evernote's Python SDK and Requests (a Python library for making HTTP requests):