I am trying to create a Notebook on Evernote, working with Java technology. I am surfing more about it on Google but he give an error:
"com.evernote.thrift.TApplicationException : Invalid method name : 'createNotebook'
at com.evernote.thrift.TApplicationException.read(TApplicationException.java : 108)
at com.evernote.edam.notestore.NoteStore$Client.recv_createNotebook(Note Store.java : 470)
at com.evernote.edam.notestore.NoteStore$Client.createNotebook(NoteStore.java : 452)
at com.estorm.controller.mail.CloudController.evernoteCloudValidation(Cl oudController.java : 203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java : 57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java : 43)
at java.lang.reflect.Method.invoke(Method.java : 606)"
Anyone please help me where is mistake. Here is my code:
String requestToken = "xxxxxxxxxx";
String USER_STORE_URL = "https://www.evernote.com/edam/user";
THttpClient noteStoreTrans = new THttpClient(USER_STORE_URL);
TBinaryProtocol noteStoreProt = new TBinaryProtocol(noteStoreTrans);
NoteStore.Client noteStore = new NoteStore.Client(noteStoreProt, noteStoreProt);
Notebook notebook = new Notebook();
notebook.setName("My Notebook");
Notebook createdNotebook = noteStore.createNotebook(requestToken, notebook);
String newNotebookGuid = createdNotebook.getGuid();
I am using EvernoteService.PRODUCTION like this:
final EvernoteService EVERNOTE_SERVICE = EvernoteService.PRODUCTION;
Class <? extends EvernoteApi > providerClass = EvernoteApi.class; {
if (EVERNOTE_SERVICE == EvernoteService.PRODUCTION) {
providerClass = org.scribe.builder.api.EvernoteApi.class;
}
}
In your code, you create
NoteStore.Client
withUSER_STORE_URL
, which is why you gotInvalid method name
since UserStore doesn't have the method while NoteStore has. So the short answer is use the NoteStore URL with your shard ID. NoteStore URL looks likehttps://www.evernote.com/shard/<Your Shard ID>/notestore
. This URL is provided as a part of the result of OAuth. If you are not familiar with what UserStore and NoteStore are, see the document here.Just guessing from your code snippet as you name one of the variables
requestToken
and use it as an authentication token, you may also misunderstand what you have to pass in to the API calls. If that's the case, you may want to read the OAuth page again. Depending on your app requirements, you may also be able to use Developer Tokens.