Evernote Shard

broken image


The salient portions here deal with the published and publishing attributes on the notebook. Published is a boolean that controls whether the notebook is publicly shared. To share a given notebook, set this value to true. Publishing is an instance of the Publishing type. At minimum, the uri attribute (which controls the ending portion of the sharing URL) must be defined for the notebook to be. Evernote uses cookies to enable the Evernote service and to improve your experience with us. To learn more, check out our cookie policy. By clicking OK or continuing to use our site, you agree that we can place these cookies.

  • The new Evernote for iOS. Open the notebook and tap the options button (three dots). Tap Share notebook. Tap the permissions next to the invitee's name to change them. Older version of Evernote for iOS. Tap the menu button (three dots). Tap Share Notebook. Tap the pencil icon to.
  • Continue with Apple. Remember me for 30 days.
  • ShardId - the ID of the shard the note is on. If you're dealing with a single user and their notes, this is the user's shard ID, eg 's29' or 's350'. The shardId can be obtained by calling the getUser method on the userStore object and inspecting the shardId attribute of the resulting user object.

Sharing Notes

Private and public note sharing

A user can share his or her Evernote notes and notebooks with a specific user, a certain group of users or the world.

This diagram shows the different sharing options in Evernote:

Sharing options

Affinity photo ai. [1] Generate unique URL giving access to everybody who knows the URL

[2] Grant access to a specific notebook to specific Evernote users

[3] Make a notebook public and share it with the world

Sharing a single note

Sharing a single note by URL

You can also share a single note by generating a URL that will allow anybody who knows the URL to view the note in a browser. The URL always shares the current content of the note, so if the note is changed after it is shared, the recipients will see the changes.

Important

An application may only turn on sharing for a note when the user explicitly chooses to do so - for example by tapping a 'share' button. You may never enable sharing without the user's explicit consent.

To enable sharing by URL for a note, you must first turn on sharing using shareNote. Evernote widget ios. This will generate a share key, which you can then use to assemble the URL:

https://host.evernote.com/shard/shardId/sh/noteGuid/noteKey

For example:

In the URL above, the shardId is s1, the note's GUID is 3554a82b-54d3-4673-8641-2bbcac94bbff, and the share key is d368012bd2c3ce342c709fefd26355a7.

Sharing can be turned off for a given note using stopSharingNote. Once stopSharingNote has been called, previously shared URLs will stop working. If sharing is later re-enabled, a new share key will be generated and a new URL will need to be assembled.

An application can also read a shared single note if it has the components used to assemble the sharing URL. Here's how your can read the note that I shared above:

Programmatically reading a shared single note (PHP)

Sharing entire notebooks

Users can also share entire notebooks, either with specific recipients or publicly. Notebooks that are shared with specific recipients can optionally require the recipient to log into Evernote to view the shared notebook. Premium users can also allow recipients to modify the notes within a shared notebook. Because of the number of possible configurations, sharing notebooks is relatively complex.

There are two data model objects involved in sharing notebooks - SharedNotebook and LinkedNotebook. The SharedNotebook object lives in the notebook owner's account - think of it as an invitation to view a specific notebook. The LinkedNotebook object lives in the share recipient's account and represents a persistent link to the notebook in the owner's account. Because users can view shared notebooks without logging into Evernote (if the notebook owner allows them to), there doesn't need to be a LinkedNotebook for every SharedNotebook.

Sharing a notebook

To share a notebook, you create a SharedNotebook object in the notebook owner's account. A SharedNotebook shares the notebook with a single email address, so to share a notebook with three friends, you will create three SharedNotebook objects.

Sharing a notebook with a single recipient (PHP)

Evernote Share Documents

Creating a SharedNotebook doesn't automatically generate an invitation to the recipient. If your application turns on sharing for a notebook by creating a SharedNotebook, you will need to ensure that the recipient receives the information that they need to access the share. Similarly, LinkedNotebooks are not created automatically. The Evernote service can create a LinkedNotebook when a user views a shared notebook invitation in their browser, or your application can programmatically accept the share and create the LinkedNotebook in the recipient's account.

Reading notes from linked notebooks

When your application accesses a user's Evernote account through the Cloud API, you can get a list of LinkedNotebooks - notebooks owned by another user that have been shared with your user. Once you have that list, you can acess the notes in the owner's notebook. To do this, you need to create a second NoteStore connection, since the owner's account and the recipient's account may be on different shards. Using that NoteStore connection, you can obtain a second authentication token that will allow you to access the contents of the shared notebook.

Once you have an authentication token to read from the shared notebook, you can use any of the NoteStore functions to interact with the notes in that notebook. The sample code above uses findNotes to get all of the notes in the shared notebook. Note that you need to you must set the NoteFilter.notebookGuid to the appropriate notebook GUID when using findNotes and findNotesMetadata on a shared notebook.

Synchronizing linked notebooks

For a complete guide on synchronizing linked notebooks, download the synchronizing guide.

Authentication

Authenticating with the Evernote Cloud API using OAuth

Introduction

The OAuth flow is the a process a user goes through to authorize your application to access their Evernote account on their behalf. The user must approve access from an Evernote domain (www.evernote.com or sandbox.evernote.com). After approval is granted (or rejected) Evernote will then redirect the user back to your application along with the information required to retrieve an access token which will allow you to access Evernote on behalf of the user.

Developer Tokens

To quickly test the Evernote API on your own account, Get a Developer Token »

The OAuth Flow consists of four parts:

Evernote Share Notebook


1. Generate a Temporary Token

First you're application must request Evernote generate a temporary token. A sample request is below:

Note: For production access replace sandbox.evernote.com with www.evernote.com.

The request must be a GET request to the following URL:

MethodEndpoint URL
GEThttps://sandbox.evernote.com/oauth

As a part of this request you must provide a number of URL-encoded parameters including a callback URL (you can use 'localhost' for development purposes) where the user will be directed after the user chooses to authorize or reject your application.

Temporary Token Request Parameters

A full list of required parameters can be seen in the table below. If you don't have an API key (oauth_consumer_key) you can get one here:

Description
oauth_callback
URL that is redirected to after the user authorizes your application access
oauth_consumer_key
sampleKey
*
oauth_signature
xCYjTiyz7GZiElg1uQaHGQ6I
*
oauth_timestamp
1429565574
*

Note: * The parameters oauth_nonce, oauth_signature, oauth_signature_method, oauth_timestamp, and oauth_version are parameters that are provided by most Evernote SDKs and OAuth libraries. If you are interested in developing an OAuth1 library for your platform please see the OAuth1 3LO specification.

Temporary Token Response

Upon transmission of a valid request you will receive the following response:

This response contains the following parameters:

Name
Sample
Temporary OAuth token
oauth_callback_confirmed
true

Evernote Shard

2. Request User Authorization

After you have retrieved the temporary token from Evernote you must redirect the user to Evernote for the user to approve access of their Evernote account to your application.

Redirection URL

Your application must use the value of the oauth_token parameter, retrieved in the last step, when redirecting the user to https://sandbox.evernote.com/OAuth.action to begin the authorization process as demonstrated in this sample redirection URL:

After the user has granted or rejected access to their Evernote account the user will be redirected back to the URL specified in the oauth_callback parameter in your temporary token request. A sample redirect URL can be seen below with the parameters expected of a user that has granted access to their Evernote account:

Callback URL Parameters
Description
oauth_token
sampleKey-121.14C..
(Optional) Present only if the user grants access to your application
sandbox_lnb
Boolean for API key permissions (see permissions for more info)

Please note that the callback for rejected and authorized apps will be the same with the exception of that a rejected callback will not contain the parameter oauth_verifier, as seen in the example below:


3. Retrieve Access Token

The following is an example of a request to retrieve an access token:

The request must be a GET request to the following URL:

Method
GET

The request must also include the URL-encoded OAuth-signed parameters listed in the table below. Please note that if you did not receive the oauth_verifier parameter in the callback the user did not grant your application access to their Evernote account and you cannot make a valid access token request

Access Token Request Parameters
Name
Sample
The API key used to identify your application
oauth_token
sampleKey-121.14C..
OAuth verify provided at callback if the user grants access
oauth_nonce
3166905818410889691
*
oauth_signature_method
HMAC-SHA1
*
oauth_version
1.0

Note: * The parameters oauth_nonce, oauth_signature, oauth_signature_method, oauth_timestamp, and oauth_version are provided by most Evernote SDKs and OAuth libraries. If you are interested in developing an OAuth1 library for your platform please see the OAuth1 3LO specification.

Access Token Response

If successful you will receive a response similar to the sample below:

the response will contain the following parameters:

Description
oauth_token
Access token to access the API on behalf of the user
oauth_token_secret
edam_shard
s432
User ID of the user (useful for webhook notifications)
edam_expires
expiration date of the token (UNIX timestamp in milliseconds)
edam_noteStoreUrl
URL of the note store of the user's personal notes
edam_webApiUrlPrefix
https://sandbox.evernote.com/shard/s432/
Access Token Expiration

Each access token has an expiration date. By default, the duration of access token validity is 1 year from the date of issue. The user can alter this duration to 1 day, 1 week or 1 month. In all these cases (including tokens valid for 1 year), the expiration date will be included as the parameter edam_expires. The value of this parameter will be a standard UNIX timestamp in units of milliseconds indicating the date and time of expiration.


4. Next Steps for Accessing the API

Using the value of oauth_token above (it should start with the form S=s432:U=4a535ee:E=154d.) you can now make requests to the API on behalf of the user that approved your application! You can use this token to perform actions in Evernote like saving content and data to notes and notebooks and (if your API key has the permission to do so) reading notes, notebooks, tags, performing searches and retrieving business data for use in your application.

Now that you have an authentication token here are some suggested next steps to dive in with the API:

  • Take a look at our SDK's sample code using your authentication token
  • Explore the API methods you can call using your access token
  • Understand Evernote's sharded service architecture for NoteStore, which can vary by user (you can learn more about sharding and Evernote's architecture in this tech blog post).
  • Learn how to revoke access tokens.
Activating an API key

Please note that while the samples for this page show URls beginning with https://sandbox.evernote.com all examples will also work on production by altering the URLs to begin with https://www.evernote.com. We recommend beginning your application development on the sandbox.

To move your key to production please request your API key be activated on production.





broken image