WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:mod-evernote.Note
Description:Accessor to NEW, SINK, SOURCE and DELETE Evernote Notes
Id:mod-evernote.Note
Category:accessor
Identifier Syntax

mod-evernote.Note is an accessor using Active URI syntax with the following base identifiers:

Base
active:evernote/Note

and the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
config
Optional
Representation (java.lang.Object)The OAuth configuration
id
Optional
Representation (java.lang.Object)Required with SOURCE, DELETE - the hash of the note in evernote
varargs [varargs] Any quantityRepresentation (java.lang.Object)Any number of additional arguments to reference as attachments
Request Verbs

The following verbs are supported:

Verbs
SOURCESINKEXISTSDELETENEW
Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use mod-evernote.Note accessor you must import the module urn:org:netkernel:mod:evernote:

<import>
  <uri>urn:org:netkernel:mod:evernote</uri>
</import>

This endpoint provides NEW, SOURCE, SINK and DELETE access to create update and delete Evernote Notes.

Create a note with a NEW request. Update a note with a SINK request. Fetch a note with a SOURCE request. Delete a note with a DELETE request.

For NEW and SINK you must provide a primary argument, this may either be a Note or a simple and convenient HDS structure (documented below in the NEW section).

The active:evernote/Template endpoint can be used to SOURCE a prototype HDS template suitable for the NEW and SINK primary argument and with a notebook hash ready assigned.

NEW

To create a new note, request the accessor with the NEW verb and provide an HDS structure with the necessary Note resources..

Here is a complete example of creating a Note.

import org.netkernel.mod.hds.*
import org.netkernel.layer0.nkf.*

t="""

    
        

Hello DOM Test

""" req=context.createRequest("active:evernote/XHTMLtoENML") req.addArgumentByValue("operand", t.toString()) dom=context.issueRequest(req) m=HDSFactory.newDocument(); m.pushNode("note") m.addNode("title", "Note from DOM with Two Attachments") m.addNode("tags", "netkernel cool ROC") m.addNode("content", dom) m.addNode("notebookHash","cab68e17-5380-4dd2-b2d7-36016cf252c2") m.pushNode("resource") m.addNode("uri", "arg:attachment") //We reference the argument which will be sourced m.addNode("filename", "my-test.txt") m.popNode(); m.pushNode("resource") m.addNode("uri", "arg:attachment2") //Ditto with another arg m.addNode("filename", "my-test2.png") req=context.createRequest("active:evernote/Note") req.setVerb(INKFRequestReadOnly.VERB_NEW) req.addPrimaryArgument(m.toDocument(false)) req.addArgumentByValue("attachment", "Hello DOM and Attachment!") //This is the argument that will be sourced req.addArgument("attachment2", "res:/test/content/enlogo.png") //This is a reference argument to an image resource to be sourced rep=context.issueRequest(req) //Returns the identifier of the new note

The response of the NEW request will be the identifier of the note, for example...

active:evernote/Note+id@4ad2d084-d60a-4934-8faf-bd090dc63c5c

Where the id argument is the hash of the newly created Evernote note. The new note may be requested by SOURCEing this identifier.

HDS as Primary Argument

If you wish to use the HDS representation, the format for the HDS primary argument is as follows

<note>
  <title />
  <tags />
  <content />
  <notebookHash />
  < !--Any number of resource attachments may be specified-->
  <resource>
    <uri />
    <filename />
  </resource>
</note>

Where

  • title - mandatory, the title of the note
  • content - mandatory, either a DOM containing ENML content, or a simple String which will be formatted into a plaintext note
  • tags - optional, space separated list of tags for the note
  • notebookHash - optional, the hash of the notebook to place this note into - if not specified the default notebook will be used (notebook hashes can be found using the active:evernote/Notebooks tool).
  • resource - optional, any number of resources to add as attachements to the note (see below).

Attachments

A note may contain any number of attachments by specifying resource structures in the HDS ...

<resource>
  <uri>The identifier of a resource to SOURCE and add as an attachement to the note</uri>
  <filename>The filename that attachment should have if downloaded from evernote</filename>
</resource>

The endpoint will SOURCE the as a binary stream. You may reference a resolvable resource in your address space, or equally you may provide active URI arguments in your request to active:evernote/Note that may then be referenced using the conventional arg:xxxx addressing.

The example above shows how a pass-by-value argument "attachment" is provided and is referenced in the HDS structure with "arg:attachment".

Note as Primary Argument

If you wish you may provide a Note object as the primary argument instead of the HDS format. You are then responsible for correctly formatting the content, adding attachments and associating the hashes of any attachments in the Note etc.

SOURCE, SINK, DELETE id argument

The id argument should be the hash of the note you wish to access.

SOURCE representation

A SOURCE request will produce a Note representation.

Here is an example

<request>
  <identifier>active:evernote/Note</identifier>
  <argument name="id">4ad2d084-d60a-4934-8faf-bd090dc63c5c</argument>
</request>

SINK Updates a Note

To update a note you issue a SINK request. The primary argument should be an HDS structure with the same representational form as for a NEW request.

Here is a simple declarative request example...

<request>
  <verb>SINK</verb>
  <identifier>active:evernote/Note</identifier>
  <argument name="id">4ad2d084-d60a-4934-8faf-bd090dc63c5c</argument>
  <argument name="primary">
    <literal type="hds">
      <note>
        <title>Edited Test</title>
        <content>Hello World</content>
      </note>
    </literal>
  </argument>
</request>

and a more complex NKF API example...

import org.netkernel.mod.hds.*
import org.netkernel.layer0.nkf.*

t="""

    
        

My Updated Note

Look the content is updated
""" req=context.createRequest("active:evernote/XHTMLtoENML") req.addArgumentByValue("operand", t.toString()) dom=context.issueRequest(req) m=HDSFactory.newDocument(); m.pushNode("note") m.addNode("title", "My Note") m.addNode("tags", "netkernel cool ROC") m.addNode("content", dom) m.addNode("notebookHash","cab68e17-5380-4dd2-b2d7-36016cf252c2") req=context.createRequest("active:evernote/Note") req.setVerb(INKFRequestReadOnly.VERB_SINK) req.addArgument("id", "4ad2d084-d60a-4934-8faf-bd090dc63c5c") req.addPrimaryArgument(m.toDocument(false)) rep=context.issueRequest(req)

Notice that you must provide the id argument to indicate the note to update.

As with NEW, if you wish you may provide a Note object as the primary argument.