I´m experiencing a weird problem with a personal application that creates some reports using content from my Evernote account. Until a month ago, everything was fine, but all of a sudden, the calls to findNotesMetadata just don't return more than 128 items, even tough the notebooks i´m processing have more than a thousand notes. I developed Java and Python versions of the app, and both are facing the same issue. I really don´t have a clue about what is going on. The apps uses a developer token for the production server, so i generated a new token, but the problem persist. Does anyone has ever faced something like this?
Here is my code. The "DEBUG LINE" print these lines. The API correctly informs that there are 1132 notes, but returns only the first 128.
100/100/1132
28/128/1132
0/128/1132
public static void main(String[] args) {
try {
EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.PRODUCTION, AUTH_TOKEN_PROD);
ClientFactory factory = new ClientFactory(evernoteAuth);
UserStoreClient userStore = factory.createUserStoreClient();
if (!userStore.checkVersion("CEVN", Constants.EDAM_VERSION_MAJOR, Constants.EDAM_VERSION_MINOR)) {
throw new Exception("Invalid protocol version");
}
NoteStoreClient noteStoreClient = factory.createNoteStoreClient();
List<NoteMetadata> lsMtds = new ArrayList<NoteMetadata>();
int offset = 0;
NotesMetadataList lsMtdsPag;
NoteFilter filter = new NoteFilter();
filter.setOrder(NoteSortOrder.TITLE.getValue());
filter.setAscending(true);
filter.setWords("stack:\"4. Referências\""); // STACK WITH MORE THAN 1000 NOTES
NotesMetadataResultSpec resultSpec = new NotesMetadataResultSpec();
resultSpec.setIncludeTitle(true);
do {
lsMtdsPag = noteStoreClient.findNotesMetadata(filter, offset, 100, resultSpec);
lsMtds.addAll(lsMtdsPag.getNotes());
for (NoteMetadata mtd : lsMtdsPag.getNotes()) {
System.out.println(mtd.getTitle());
}
offset += lsMtdsPag.getNotesSize();
System.out.println(lsMtdsPag.getNotesSize()+"/"+offset+"/"+lsMtdsPag.getTotalNotes()); // DEBUG LINE
} while (lsMtdsPag.getTotalNotes() > offset && lsMtdsPag.getNotesSize() > 0);
} catch (Exception e) {
e.printStackTrace();
}
}
Idea
mybanez 2
Hello folks,
I´m experiencing a weird problem with a personal application that creates some reports using content from my Evernote account. Until a month ago, everything was fine, but all of a sudden, the calls to findNotesMetadata just don't return more than 128 items, even tough the notebooks i´m processing have more than a thousand notes. I developed Java and Python versions of the app, and both are facing the same issue. I really don´t have a clue about what is going on. The apps uses a developer token for the production server, so i generated a new token, but the problem persist. Does anyone has ever faced something like this?
Here is my code. The "DEBUG LINE" print these lines. The API correctly informs that there are 1132 notes, but returns only the first 128.
100/100/1132
28/128/1132
0/128/1132
public static void main(String[] args) {
try {
EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.PRODUCTION, AUTH_TOKEN_PROD);
ClientFactory factory = new ClientFactory(evernoteAuth);
UserStoreClient userStore = factory.createUserStoreClient();
if (!userStore.checkVersion("CEVN", Constants.EDAM_VERSION_MAJOR, Constants.EDAM_VERSION_MINOR)) {
throw new Exception("Invalid protocol version");
}
NoteStoreClient noteStoreClient = factory.createNoteStoreClient();
List<NoteMetadata> lsMtds = new ArrayList<NoteMetadata>();
int offset = 0;
NotesMetadataList lsMtdsPag;
NoteFilter filter = new NoteFilter();
filter.setOrder(NoteSortOrder.TITLE.getValue());
filter.setAscending(true);
filter.setWords("stack:\"4. Referências\""); // STACK WITH MORE THAN 1000 NOTES
NotesMetadataResultSpec resultSpec = new NotesMetadataResultSpec();
resultSpec.setIncludeTitle(true);
do {
lsMtdsPag = noteStoreClient.findNotesMetadata(filter, offset, 100, resultSpec);
lsMtds.addAll(lsMtdsPag.getNotes());
for (NoteMetadata mtd : lsMtdsPag.getNotes()) {
System.out.println(mtd.getTitle());
}
offset += lsMtdsPag.getNotesSize();
System.out.println(lsMtdsPag.getNotesSize()+"/"+offset+"/"+lsMtdsPag.getTotalNotes()); // DEBUG LINE
} while (lsMtdsPag.getTotalNotes() > offset && lsMtdsPag.getNotesSize() > 0);
} catch (Exception e) {
e.printStackTrace();
}
}
9 replies to this idea
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now