Skip to content

Instantly share code, notes, and snippets.

@Laurent-Sarrazin
Created May 2, 2014 11:40
Show Gist options
  • Save Laurent-Sarrazin/0a9bb288d780d43ade93 to your computer and use it in GitHub Desktop.
Save Laurent-Sarrazin/0a9bb288d780d43ade93 to your computer and use it in GitHub Desktop.
Evernote API : create notes in a linked notebook
$authToken = "YOUR DEV TOKEN";
$client = new Client(array('token' => $authToken));
$noteStore = $client->getNoteStore();
# get linked notebooks
$linked_notebooks = $noteStore->listLinkedNotebooks($authToken);
$linked_notebook = $linked_notebooks[0];
# shareKey for the first notebook
$shareKey = $linked_notebook->shareKey;
# get the right noteStore
$note_store_uri = $linked_notebook->noteStoreUrl;
$shared_note_store = $client->getSharedNoteStore($linked_notebook);
# authenticate to the linked notebook
$auth_result = $shared_note_store->authenticateToSharedNotebook($shareKey, $authToken);
# get the share token
$share_token = $auth_result->authenticationToken;
# get the shared notebook
$sharedNotebook = $shared_note_store->getSharedNotebookByAuth($share_token);
$guid = $sharedNotebook->notebookGuid;
$note = new Note();
$note->notebookGuid = $guid;
$note->title = 'It Works';
$shared_note_store->createNote($share_token, $note);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment