Evernote Authenticate an Element Instance

You can authenticate with Evernote to create your own instance of the Evernote element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the Evernote platform.

Authenticate Through the UI

Use the UI to authenticate with Evernote and create an element instance as described in Authenticate an Element Instance (UI). In addition to the base authentication parameters, you will need the credentials that you identified in API Provider Setup.

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Authenticating through API is similar to authenticating via the UI. Instead of clicking and typing through a series of buttons, text boxes, and menus, you will instead send a request to our instance endpoint. The end result is the same, though: an authenticated element instance with a token and id.

Authenticating through API follows a multi-step OAuth process that involves:


1
Outh Token




2
OAuth URL




3
Authenticate Instance


  • Getting an OAuth token. Request the token and secret to be used in later steps.
  • Getting an OAuth URL. Use the token from the previous step to request a URL to redirect your users to. After they authenticate through this URL, you receive and oauth_token and oauth_verifier to use in the next step.
  • Authenticating the element instance. Using the secret returned in step one, along with the oauth_token and oauth_verifier returned in step two to authenticate with the API Provider to create an element instance at Cloud Elements.

Getting an OAuth Token


1
Oauth Token




2
OAuth URL




3
Authenticate Instance


Use the following API call to request a secret and token. Replace {keyOrId} with the element key, evernote.

curl -X GET /elements/{keyOrId}/oauth/token?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&siteAddress=<url>

Query Parameters

Query ParameterDescription
apiKeyThe API key or client ID obtained from registering your app with the provider. This is the Consumer Key that you recorded in API Provider Setup.
apiSecretThe client secret obtained from registering your app with the API provider. This is the Consumer Secret that you recorded in API Provider Setup.
callbackUrlThe API key or client ID obtained from registering your app with the provider.

Example cURL

curl -X GET \
'https://api.cloud-elements.com/elements/api-v2/elements/evernote/oauth/token?apiKey=Rand0MAP1-key&apiSecret=fak3AP1-s3Cr3t&callbackUrl=https:%3A%2F%2Fwww.mycoolapp.com%2auth' \

Example Response

Use the oauthUrl in the response to allow users to authenticate with the vendor.

{
    "secret": "4006B6SU5ZJ55RBUWN58OZVPE",
    "token": "evernoteALG86K3XCI190U9VDER7FDSI4MAGPRF0161RPQYBALG86K3XCI190U9VDER7ALG86K3XCI190U9VDER7"
}

Getting an OAuth URL


1
Oauth Token




2
OAuth URL




3
Authenticate Instance


Use the following API call to request a redirect URL where the user can authenticate with the API provider. Replace {keyOrId} with the element key, evernote.

GET /elements/{keyOrId}/oauth/url?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&siteAddress=<url>&scope=false&requestToken=<oauth_token RECEIVED IN PREVIOUS STEP>

Query Parameters

Query ParameterDescription
apiKeyThe key obtained from registering your app with the provider. This is the Consumer Key that you recorded in API Provider Setup.
apiSecretThe secret obtained from registering your app with the provider. This is the Consumer Secret that you recorded in API Provider Setup.
callbackUrlThe URL that will receive the code from the vendor to be used to create an element instance. This is the Callback URL that you noted at the end of the API Provider Setup.
scopeSet to false
requestTokenThe Request Token (oauth_token) obtained from Evernote in the previous step

Example cURL

curl -X GET
-H 'Content-Type: application/json'
'https://api.cloud-elements.com/elements/api-v2/elements/evernote/oauth/url?apiKey=fake_api_key&apiSecret=fake_api_secret&callbackUrl=https://httpbin.org/get&scope=false&requestToken=evernoteALG86K3XCI190U9VDER7FDSI4MAGPRF0161RPQYBALG86K3XCI190U9VDER7ALG86K3XCI190U9VDER7'

Example Response

Use the oauthUrl in the response to allow users to authenticate with the vendor.

{
  "oauthUrl": "https://sandbox.evernote.com/OAuth.action?oauth_token=evernoteALG86K3XCI190U9VDER7FDSI4MAGPRF0161RPQYBALG86K3XCI190U9VDER7ALG86K3XCI190U9VDER7",
  "element": "box"
}

Authenticating the Element Instance


1
Oauth Token




2
OAuth URL




3
Authenticate Instance


Use the secret from step one and the oauth_token and oauth_verifier returned in step two to make a request to the /instances endpoint to authenticate an element instance.

Note: The endpoint returns an element instance token and id upon successful completion. Retain the token and id for all subsequent requests involving this element instance.

To authenticate an element instance:

  1. Construct a JSON body as shown below (see Parameters):

      {
        "element": {
          "key": "evernote"
        },
        "providerData": {
          "secret": "<From Step 1>",
          "oauth_token": "<From Step 1>",
          "oauth_verifier": "<From Return URL>"
        },
        "configuration": {
          "oauth.api.key": "<INSERT_EVERNOTE_CONSUMER_KEY>",
          "oauth.api.secret": "<INSERT_EVERNOTE_CONSUMER_SECRET>",
          "oauth.request.url": "https://evernote.com",
          "oauth.callback.url": "<INSERT_CALLBACK_URL>",
          "evernote.sandbox": "https://sandbox.evernote.com"
        },
        "tags": [
          "<INSERT_TAGS>"
        ],
        "name": "<INSERT_INSTANCE_NAME>"
      }
    
    {
      "element": {
        "key": "evernote"
      },
      "providerData": {
        "secret": "<From Step 1>",
        "oauth_token": "<From Step 1>",
        "oauth_verifier": "<From Return URL>"
      },
      "configuration": {
        "oauth.api.key": "<Evernote app Consumer Key>",
        "oauth.api.secret": "<Evernote app Consumer Secret>",
        "oauth.callback.url": "<Evernote app Callback URL Name >",
        "oauth.request.url": "<https://evernote.com or https://sandbox.evernote.com>",
        "evernote.sandbox": "<true or false>"
      },
      "tags": [
        "<Add_Your_Tag>"
      ],
      "name": "<INSTANCE_NAME>"
    }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Example cURL

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/instances \
  -H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
  -H 'content-type: application/json' \
  -d '{
  "element": {
    "key": "evernote"
  },
  "providerData": {
    "secret": "15D1CFxxxxxxxxxxxxxxxxxxxxxx",
    "oauth_token": "evernoteALG86K3XCI190U9VDER7FDSI4MAGPRF0161RPQYBALG86K3XCI190U9VDER7ALG86K3XCI190U9VDER7",
    "oauth_verifier": "Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  },
  "configuration": {
    "oauth.callback.url": "https;//mycoolapp.com",
    "oauth.api.key": "xxxxxxxxxxxxxxxxxx",
    "oauth.api.secret": "xxxxxxxxxxxxxxxxxxxxxxxx",
    "oauth.request.url": "https://sandbox.evernote.com",
    "evernote.sandbox": "true"
  },
  "tags": [
    "Docs"
  ],
  "name": "API Instance"
}'

Parameters

API parameters not shown in Cloud Elements are in code formatting.


1
Oauth Token




2
OAuth URL




3
Authenticate Instance


ParameterDescriptionData Type
keyThe element key.
evernote
string
secretThe secret returned in the response to getting the OAuth token.string
oauth_tokenThe oauth_token in the response to getting the OAuth token. Evernote also returns the oauth_token in the response after a user authorizes your app.string
oauth_verifierA value in the Evernote response after a user authorizes your app.
Name
name
The name of the element instance created during authentication.string
oauth.api.keyThe API key or client ID obtained from registering your app with the provider. This is the Consumer Key that you noted in API Provider Setup.string
oauth.api.secretThe client secret obtained from registering your app with the API provider. This is the Consumer Secret that you noted in API Provider Setup.string
oauth.callback.urlThe API key or client ID obtained from registering your app with the provider.string
oauth.request.urlOne of either https://evernote.com for production account or https://sandbox.evernote.com for sandbox accounts.string
evernote.sandboxSet to true if authenticating with a sandbox account and false if using a production account.
tagsOptional. User-defined tags to further identify the instance.string

Example Response for an Authenticated Element Instance

In this example, the instance ID is 12345 and the instance token starts with "ABC/D...". The actual values returned to you will be unique: make sure you save them for future requests to this new instance.

{
  "id": 12345,
  "name": "API Instance",
  "createdDate": "2018-01-22T20:55:08Z",
  "token": "ABC/Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "element": {
        "id": 125,
        "name": "Evernote",
        "hookName": "Evernote",
        "key": "evernote",
        "description": "Add an Evernote Instance to connect your existing Evernote account to the Documents Hub, allowing you to manage files and folders. You will need your Evernote account information to add an instance.",
        "image": "elements/provider_evernote.png",
        "active": true,
        "deleted": false,
        "typeOauth": true,
        "trialAccount": false,
        "configDescription": "Evernote configuration",
        "transformationsEnabled": false,
        "bulkDownloadEnabled": false,
        "bulkUploadEnabled": false,
        "cloneable": false,
        "extendable": false,
        "beta": false,
        "authentication": {
            "type": "oauth2"
        },
        "extended": false,
        "hub": "documents",
        "protocolType": "http",
        "parameters": [],
        "private": false
    },
    "elementId": 125,
    "tags": [
        "Docs"
    ],
    "provisionInteractions": [],
    "valid": true,
    "disabled": false,
    "maxCacheSize": 0,
    "cacheTimeToLive": 0,
    "providerData": {   },
    "configuration": {   },
    "eventsEnabled": false,
    "traceLoggingEnabled": false,
    "cachingEnabled": false,
    "externalAuthentication": "none",
    "user": {
        "id": 3306,
        "emailAddress": "claude.elements@cloud-elements.com",
        "firstName": "Claude",
        "lastName": "Elements"
      }
}