Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Photo

SHARD_UNAVAILABLE when filtering with tags (Java API 1.23)


  • Please log in to reply
7 replies to this topic

#1 designersheep

designersheep

  • Pip
  • Title: Member
  • Group: Members
  • 9 posts

Posted 12 February 2013 - 09:14 AM

I get SHARD_UNAVAILABLE exception when trying to filter by tags.  It gives me correct results when I filter using notebooks but tag always throws me either a permission denied (if I use empty token), or shard unavailable if I use my normal token.  Is there a way to get a token for a public notebook?  I don't have this problem when I am trying to access privately shared notebooks.
 
This code below works:
 

 

               filter.setNotebookGuid(filterGUID);
                NoteList notes = authInfo.noteStore.findNotes(authInfo.accessToken, filter, 0, maxNotes);
 

 

The code below doesn't:

 

 

                ArrayList<String> tagList = new ArrayList<String>();
                tagList.add(t.getGuid());
                filter.setTagGuids(tagList);
                NoteList notes = authInfo.noteStore.findNotes(authInfo.accessToken, filter, 0, maxNotes);

 

 

Exception:

 
EDAMSystemException(errorCode:SHARD_UNAVAILABLE, message:s202)
    at com.evernote.edam.notestore.NoteStore$findNotes_result.read(NoteStore.java:11762)
    at com.evernote.edam.notestore.NoteStore$Client.recv_findNotes(NoteStore.java:1153)
    at com.evernote.edam.notestore.NoteStore$Client.findNotes(NoteStore.java:1125)
 

or when using empty token

 

EDAMUserException(errorCode:PERMISSION_DENIED, parameter:authenticationToken)
    at com.evernote.edam.notestore.NoteStore$findNotes_result.read(NoteStore.java:11754)
    at com.evernote.edam.notestore.NoteStore$Client.recv_findNotes(NoteStore.java:1153)
    at com.evernote.edam.notestore.NoteStore$Client.findNotes(NoteStore.java:1125)
 

Any help would be highly appreciated :)


Lead developer of Mohiomap

https://www.moh.io/mohiomap/


#2 Laurent Sarrazin

Laurent Sarrazin

  • Title: Browncoat
  • Group: Developer Evangelist
  • 339 posts

Posted 12 February 2013 - 12:21 PM

According to the documentation, this is a temporary issue : http://dev.evernote....nce/Errors.html

 

 
EDAMSystemException : This exception is thrown by EDAM procedures when a call fails as a result of a problem in the service that could not be changed through caller action.


#3 Laurent Sarrazin

Laurent Sarrazin

  • Title: Browncoat
  • Group: Developer Evangelist
  • 339 posts

Posted 12 February 2013 - 12:38 PM

The equivalent PHP code works for me (I don't have a java platform to test on right now).

But I'm not on the same shard so...



#4 Laurent Sarrazin

Laurent Sarrazin

  • Title: Browncoat
  • Group: Developer Evangelist
  • 339 posts

Posted 12 February 2013 - 02:49 PM

This code works for me :

 

/**
       * Retrieve and display a list of the user's notes by tag.
       */
      private void listNotesByTags()
        throws Exception
      {
        // List the notes in the user's account
        System.out.println("Listing notes by tags:");

        // First, get a list of all notebooks
        //List<Notebook> notebooks = noteStore.listNotebooks(authToken);

        NoteFilter filter = new NoteFilter();
        ArrayList<String> tagList = new ArrayList<String>();
        tagList.add("03d37ca1-c81d-458a-b523-5cac84d085dd");
        filter.setTagGuids(tagList);
        NoteList noteList = noteStore.findNotes(authToken, filter, 0, 10);

        List<Note> notes = noteList.getNotes();
        for (Note note : notes) {
          System.out.println(" * " + note.getTitle());
        }
        System.out.println();
      }


#5 Mustafa

Mustafa

  • Title: Browncoat
  • Group: Evernote Employee
  • 348 posts

Posted 12 February 2013 - 06:38 PM

If you were using the production service, there was a brief interruption that might have caused that. More info here



#6 designersheep

designersheep

  • Pip
  • Title: Member
  • Group: Members
  • 9 posts

Posted 13 February 2013 - 12:01 AM

Thanks everyone, but it's still not working for me.  Perhaps I'm doing something wrong when I'm creating the notestore.  Strangest thing is that it works for privately shared notebook.

 

From my exception stack trace above, the error message says s202, but the tag resides in s212.  I did use s202 accessToken though, because it won't accept an empty string for the token, whereas when I am doing a findNotes with notebook ID as filter it WOULD accept an empty access token.  Is there a way to create a valid access token for s212 when I have access to it as a publicly shared notebook?

 

// I use this code to create the notestore, where url is the url to the correct shard (s212)
THttpClient noteStoreTrans = new THttpClient(url);
TBinaryProtocol noteStoreProt = new TBinaryProtocol(noteStoreTrans);
newNoteStore = new NoteStore.Client(noteStoreProt, noteStoreProt);

...

// and I use the code below for accessing privately shared notebooks, but it throws exception on publicly shared notebooks and I've been just using an empty token so far until I ran into this tag based find problem
AuthenticationResult res = linkedStore.authenticateToSharedNotebook(nb.getShareKey(), accessToken);
newToken = res.getAuthenticationToken();

Lead developer of Mohiomap

https://www.moh.io/mohiomap/


#7 Laurent Sarrazin

Laurent Sarrazin

  • Title: Browncoat
  • Group: Developer Evangelist
  • 339 posts

Posted 13 February 2013 - 02:31 PM

I'm not sure that I exactly understand what you're trying to do but here are a few things to consider :

 

- when you're accessing a privately shared notebook you need a shareKey because it's ... private.

- when you're accessing a public notebook you don't need a shareKey because everyone can access it.

 

so, in your case, you don't need to get a token or anything else to access this public notebook.

 

All you have to do when you want to find notes in a public notebook is setting the notebook guid in addition to you other filter parameters.

So this code should work :

 

THttpClient noteStoreTrans = new THttpClient("http://www.evernote.com/edam/note/s212");
TBinaryProtocol noteStoreProt = new TBinaryProtocol(noteStoreTrans);
noteStore = new NoteStore.Client(noteStoreProt, noteStoreProt);

NoteFilter filter = new NoteFilter();
ArrayList<String> tagList = new ArrayList<String>();
tagList.add(%the_tag_guid%);
filter.setTagGuids(tagList);
filter.setNotebookGuid(%the_public_notebook_guid%);
NoteList noteList = noteStore.findNotes("", filter, 0, 10);

 

At least, it works for me ;)



#8 designersheep

designersheep

  • Pip
  • Title: Member
  • Group: Members
  • 9 posts

Posted 13 February 2013 - 11:53 PM

Thank you Laurent,

 

Your latest code worked for me, only difference being that I had to set the notebook GUID on the filter, which I didn't need to do for privately shared notes.  Now it is working great!


Lead developer of Mohiomap

https://www.moh.io/mohiomap/





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Clip to Evernote