80
Mustafa Furniturewala Evernote Mobile SDKs: Getting Started with the Evernote API Monday, September 30, 13

EC3 Workshop - Evernote API with Mobile SDKs

Embed Size (px)

DESCRIPTION

Slides from the EC3 workshop : http://evernote.com/ec/

Citation preview

Page 1: EC3 Workshop - Evernote API with Mobile SDKs

Mustafa Furniturewala Evernote

Mobile SDKs: Getting Started with the Evernote API

Monday, September 30, 13

Page 2: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Evernote API

• Access to a user’s Evernote account/business

• Read/Create/Find notes

• FindRelated/Reminders

Monday, September 30, 13

Page 3: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Mobile SDK’s

Monday, September 30, 13

Page 4: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Mobile SDK’s

• Easy to use - hide complexities

Monday, September 30, 13

Page 5: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Mobile SDK’s

• Easy to use - hide complexities

• Local API’s

Monday, September 30, 13

Page 6: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Mobile SDK’s

• Easy to use - hide complexities

• Local API’s

• Support popular environments (cocoapods/maven)

Monday, September 30, 13

Page 7: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Mobile SDK’s

• Easy to use - hide complexities

• Local API’s

• Support popular environments (cocoapods/maven)

• Wrappers

Monday, September 30, 13

Page 8: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

Monday, September 30, 13

Page 9: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

Monday, September 30, 13

Page 10: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

1. Create an account on sandbox.evernote.com

Monday, September 30, 13

Page 11: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

1. Create an account on sandbox.evernote.com

2. Get your consumer key

Monday, September 30, 13

Page 12: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

1. Create an account on sandbox.evernote.com

2. Get your consumer key

3. Download the SDK

Monday, September 30, 13

Page 13: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

1. Create an account on sandbox.evernote.com

2. Get your consumer key

3. Download the SDK

4. Start using the API’s

Monday, September 30, 13

Page 14: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Authentication

Monday, September 30, 13

Page 15: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Authentication

1. OAuth 1.0a

Monday, September 30, 13

Page 16: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Authentication

1. OAuth 1.0a

2. Mobile SDK’s handle everything for you

Monday, September 30, 13

Page 17: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Authentication

1. OAuth 1.0a

2. Mobile SDK’s handle everything for you

3. Github

Monday, September 30, 13

Page 21: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Yinxiang Biji

1. Evernote’s China service

2. Bootstrapping

3. Mobile SDK’s handle everything for you

Monday, September 30, 13

Page 22: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Yinxiang Biji

1. Evernote’s China service

2. Bootstrapping

3. Mobile SDK’s handle everything for you

Monday, September 30, 13

Page 23: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

Monday, September 30, 13

Page 24: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

Monday, September 30, 13

Page 25: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

•[EvernoteSession sharedSession]

Monday, September 30, 13

Page 26: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

•[EvernoteSession sharedSession]

•- (void)authenticateWithViewController:completionHandler:

Monday, September 30, 13

Page 27: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

•[EvernoteSession sharedSession]

•- (void)authenticateWithViewController:completionHandler:

•[EvernoteUserStore userStore]

Monday, September 30, 13

Page 28: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

•[EvernoteSession sharedSession]

•- (void)authenticateWithViewController:completionHandler:

•[EvernoteUserStore userStore]

•[EvernoteNoteStore noteStore]

Monday, September 30, 13

Page 29: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Getting started

•[EvernoteSession sharedSession]

•- (void)authenticateWithViewController:completionHandler:

•[EvernoteUserStore userStore]

•[EvernoteNoteStore noteStore]

Monday, September 30, 13

Page 30: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Note

Metadata

Body

Attachments

Monday, September 30, 13

Page 31: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

• Markup language for the body of a note

• Rich content

• Based on XHTML

• Validate against the DTD

Monday, September 30, 13

Page 32: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

Monday, September 30, 13

Page 33: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">

<en-note>

<div><en-todo></en-todo>Checkbox 1</div>

<div><en-todo checked="true"></en-todo>Checkbox 2</div>

<div><br clear="none"/></div>

<div><ol><li>Number 1</li><li>Number 2</li></ol></div>

</en-note>

Monday, September 30, 13

Page 34: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

Monday, September 30, 13

Page 35: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

en-note

Monday, September 30, 13

Page 36: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

en-note

en-media

Monday, September 30, 13

Page 37: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

en-note

en-media

en-crypt

Monday, September 30, 13

Page 38: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML

en-note

en-media

en-crypt

en-todo

Monday, September 30, 13

Page 39: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Write ENML

Monday, September 30, 13

Page 40: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Write ENML

ENMLWriter - iOS only

Monday, September 30, 13

Page 41: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Write ENML

ENMLWriter - iOS only

(void) writeResource:(EDAMResource *)resource;

Monday, September 30, 13

Page 42: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Write ENML

ENMLWriter - iOS only

(void) writeResource:(EDAMResource *)resource;

(void) writeEncryptedInfo:(ENEncryptedContentInfo *)encryptedInfo;

Monday, September 30, 13

Page 43: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Write ENML

ENMLWriter - iOS only

(void) writeResource:(EDAMResource *)resource;

(void) writeEncryptedInfo:(ENEncryptedContentInfo *)encryptedInfo;

(void) writeTodoWithCheckedState:(BOOL)checkedState;

Monday, September 30, 13

Page 44: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML Writer

EDAMData *edamData = [[EDAMData alloc] initWithBodyHash:dataHash size:myFileData.length body:myFileData];

EDAMResource* resource = [[EDAMResource alloc] init];

[resource setData:edamData];

[resource setMime:@"image/png"];

ENMLWriter* myWriter = [[ENMLWriter alloc] init]

Monday, September 30, 13

Page 45: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

ENML Writer

[myWriter startDocument];

[myWriter startElement:@"span"];

[myWriter startElement:@"br"];

[myWriter endElement];

[myWriter writeResource:resource];

[myWriter endElement];

[myWriter endDocument];

Monday, September 30, 13

Page 46: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

View ENML

ENML -> HTML

- (void) convertENMLToHTML:enmlContent completionBlock:

Monday, September 30, 13

Page 47: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Sharing and Business

Monday, September 30, 13

Page 48: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Sharing and Business

• Share notes/notebooks

Monday, September 30, 13

Page 49: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Sharing and Business

• Share notes/notebooks

• Business API

Monday, September 30, 13

Page 50: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Sharing and Business

• Share notes/notebooks

• Business API

• SDK’s help you out

Monday, September 30, 13

Page 51: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Helpful SDK functions

• List notes for a shared notebook

• List all the business notebooks

• Create a business notebook

• Create a note in a business notebook

Monday, September 30, 13

Page 52: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

Monday, September 30, 13

Page 53: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

Monday, September 30, 13

Page 54: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

Monday, September 30, 13

Page 55: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[noteFilter setWords:@"sourceApplication:postit"];

Monday, September 30, 13

Page 56: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[noteFilter setWords:@"sourceApplication:postit"];

EDAMNotesMetadataResultSpec* metadataResultSpec = [[EDAMNotesMetadataResultSpec alloc] init];

Monday, September 30, 13

Page 57: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[noteFilter setWords:@"sourceApplication:postit"];

EDAMNotesMetadataResultSpec* metadataResultSpec = [[EDAMNotesMetadataResultSpec alloc] init];

[metadataResultSpec setIncludeTitle:YES];

Monday, September 30, 13

Page 58: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[noteFilter setWords:@"sourceApplication:postit"];

EDAMNotesMetadataResultSpec* metadataResultSpec = [[EDAMNotesMetadataResultSpec alloc] init];

[metadataResultSpec setIncludeTitle:YES];

[noteStore findNotesMetadataWithFilter:noteFilter offset:0 maxNotes:100 resultSpec:metadataResultSpec success:^(EDAMNotesMetadataList *metadata)} failure:^(NSError *error) {}];

Monday, September 30, 13

Page 59: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - Get all the Post-it® notes

EvernoteNoteStore *noteStore = [EvernoteNoteStore noteStore];

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[noteFilter setWords:@"sourceApplication:postit"];

EDAMNotesMetadataResultSpec* metadataResultSpec = [[EDAMNotesMetadataResultSpec alloc] init];

[metadataResultSpec setIncludeTitle:YES];

[noteStore findNotesMetadataWithFilter:noteFilter offset:0 maxNotes:100 resultSpec:metadataResultSpec success:^(EDAMNotesMetadataList *metadata)} failure:^(NSError *error) {}];

Monday, September 30, 13

Page 60: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - List notes from a shared notebook

Monday, September 30, 13

Page 61: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - List notes from a shared notebook

EvernoteNoteStore *defaultNoteStore = [EvernoteNoteStore noteStore];

Monday, September 30, 13

Page 62: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - List notes from a shared notebook

EvernoteNoteStore *defaultNoteStore = [EvernoteNoteStore noteStore];

[defaultNoteStore listLinkedNotebooksWithSuccess:^(NSArray *linkedNotebooks) {

Monday, September 30, 13

Page 63: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - List notes from a shared notebook

EvernoteNoteStore *defaultNoteStore = [EvernoteNoteStore noteStore];

[defaultNoteStore listLinkedNotebooksWithSuccess:^(NSArray *linkedNotebooks) {

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

Monday, September 30, 13

Page 64: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Example - List notes from a shared notebook

EvernoteNoteStore *defaultNoteStore = [EvernoteNoteStore noteStore];

[defaultNoteStore listLinkedNotebooksWithSuccess:^(NSArray *linkedNotebooks) {

EDAMNoteFilter* noteFilter = [[EDAMNoteFilter alloc] init];

[defaultNoteStore listNotesForLinkedNotebook:linkedNotebooks[0] withFilter:noteFilter success:^(EDAMNoteList *list) { } failure:^(NSError *error) { }];}

Monday, September 30, 13

Page 65: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Interact with the Evernote app

Monday, September 30, 13

Page 66: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Interact with the Evernote app

1. Create notes

Monday, September 30, 13

Page 67: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Interact with the Evernote app

1. Create notes

2. View a note

Monday, September 30, 13

Page 68: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Interact with the Evernote app

1. Create notes

2. View a note

3. Authentication

Monday, September 30, 13

Page 69: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Interact with the Evernote app

1. Create notes

2. View a note

3. Authentication

4. Intents on Android

Monday, September 30, 13

Page 70: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Wrappers - Local API

Monday, September 30, 13

Page 71: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Wrappers - Local API

- (void)viewNoteInEvernote:

Monday, September 30, 13

Page 72: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Wrappers - Local API

- (void)viewNoteInEvernote:

- (void)saveNewNoteToEvernoteApp:

Monday, September 30, 13

Page 73: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Wrappers - Local API

- (void)viewNoteInEvernote:

- (void)saveNewNoteToEvernoteApp:

Monday, September 30, 13

Page 74: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Open source

Monday, September 30, 13

Page 75: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Open source

Submit pull requests

Monday, September 30, 13

Page 76: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Open source

Submit pull requests

Open issues

Monday, September 30, 13

Page 77: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Open source

Submit pull requests

Open issues

Github.com/evernote

Monday, September 30, 13

Page 78: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Popular apps

Pocket Lightly

Monday, September 30, 13

Page 79: EC3 Workshop - Evernote API with Mobile SDKs

#EC2013

Popular apps

Dolphin Browser

Monday, September 30, 13