16
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Evernote APIのいろいろ

Last updated at Posted at 2013-01-14

Railsを利用
<参考URL>
Evernote API Reference
http://dev.evernote.com/documentation/reference/NoteStore.html#Fn_NoteStore_findNotes

tokenの取得方法

Gemfile
gem "omniauth-evernote"
gem "evernote_oauth"
session_controller.rb
token = params[:oauth_token]

auth = request.env["omniauth.auth"]
provider = auth["info"]["provider"]
name = auth["info"]["nickname"]
uid = auth["uid"]

(注)sandbox modeでは、下記で取得したtokenを利用する
https://sandbox.evernote.com/api/DeveloperToken.action

notebook listの取得方法

client = EvernoteOAuth::Client.new(token: session[:token])
@note_stores = client.note_store.listNotebooks

note listの取得方法

filter = Evernote::EDAM::NoteStore::NoteFilter.new
filter.notebookGuid = @note_stores.first.guid  #先頭のnotebookのguidを指定
@note = client.note_store.findNotes(session[:token], filter, 0, 100)  #offset -> 0 , max_size -> 100

note listの表示方法

notes.html.erb
<% @note.notes.each do |n| %>
  <%= n.title %>
<% end %>

Evernote guidのフォーマット

^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

16
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?