# Custom REST Connector Parameters

Certain values used in the REST API can be quite lengthy or overly complicated to use multiple times in an API call. Sisense provides several types of Configuration parameters that you can use to refer to values.

For example, if you have previously used an access_token through OAuth2 authentication, Sisense stores this value in memory and allows you to recall this value by referring to it as [@access_token].

There are three types of configuration parameters:

  • In Memory Parameters: These parameters are saved by Sisense In Memory and can be referred in later REST API calls.
  • Configuration Reference Parameters: These parameters refer to other parameters used in the configuration JSON file.
  • Result Reference Parameters: These parameters refer to parameters returned after execution.

# In Memory Parameters

In Memory parameters are saved in Sisense memory and can be referenced for future API calls by adding the prefix [@parameter_name] as the value of the parameter. Sisense currently supports the following In Memory parameters:

  • [@accesstoken]: Reference to the credential parameter access_token returned as a result of OAuth2 authentication.
  • [@today]: Current date formatted as yyyy-MM-dd. This In memory parameter can be used with the Days parameter, for example, [@today-1] means yesterday, [@today+30] means the current date plus 30 days, etc.
  • [@now]: Current time. This parameter can also be modified, for example, [@now - 60] means a minute ago, [@now + 3600] is an hour (3600 seconds) ahead, etc.
  • [@accumulative]: Reference to the AccumulativeSettings object. This object determines where an accumulative builds starts. This reference must be included in each table you want support accumulative builds. For more information, see [AccumulativeSettings].

# Configuration Reference Parameters

Configuration Reference parameters refer to the values of parameters listed in your configuration JSON file.

For example, the shortcut [@Settings.Provider] refers to the value you defined as the value of Provider in the Settings object.

# Result Reference Parameters

Result Reference parameters refer to data returned by the data source after execution in JSON format as a JSON Document.

Usually this document contains the results with the data requested represented as a JSON Array and some additional metadata needed for determining if there is more data, or some parameters for the next page.

For example, the Result Reference parameters can refer to:

  • All of the executed data: [@Tables.ActionName.@.]
  • Some data taken from the entire returned document: [@Tables.Comment.@.next_page]
  • All requested data results as a JSON Array, not transformed with no metadata included: [@Tables.Comment.@.~]
  • All returned records as a single JSON Array with documents already transformed: [@Table.Comment.@.Doc.All]
  • Some value from a transformed document taken by path: [@Table.Comment.@.Doc.via.channel]

# Example

This example configuration uses the various supported parameter types:

{
    "Settings": {
        "Provider": "rest-marketo", 
        "ConnectorAssemblyFileName": "_rest.tag",
        "FileList":  [  
            "config.json", "oauth2Config.json"
        ], 
        "MaxDocs": 500,
        "FetchSize": 1000,
        "Parameters": {
        "uri": "https://123-OXE-123.mktorest.com"
        }
    },
    "Credentials": {
        "Auth": {
        "Name": "OAuth2",
        "Public": "False",
        "Schema": "Https",
        "Method": "GET",
        "Base": "[@Settings.Parameters.uri]",
        "Path": "identity/oauth/token",
        "Headers": {},
        "PathParameters": [],
        "QueryParameters": {
            "grant_type": "client_credentials",
            "client_id": "....",
            "client_secret": "...."
        },
        "Body": {}
        }
    },
    "Tables": [
        {
        "Name": "PagingToken",
        "Public": "false",
        "Schema": "Https",
        "Method": "GET",
        "Base": "https://123-oxe-123.mktorest.com",
        "Path": "rest/v1/activities/pagingtoken.json",
        "QueryParameters": {
            "access_token": "[@Credentials.Auth.@~Doc.access_token]",
            "sinceDatetime": "2015-05-1",
            "_method": "GET"
        },
        "Body": {}
        },
        {
        "Name": "Activities",
        "Schema": "Https",
        "Public": "true",
        "Method": "GET",
        "Base": "[@Settings.Parameters.uri]",
        "Path": "rest/v1/activities.json",
        "QueryParameters": {
            "access_token": "[@Credentials.Auth.@~Doc.access_token]",
            "nextPageToken": "[@Tables.PagingToken.@~Doc.nextPageToken]",
            "listId": "12345"
        },
        "ArrayQueryParameters": { "activityTypeIds": [ "1", "3", "40", "41", "7", "47", "11" ] },
        "PagingConfig": {
            "Type": "URL",
            "KeepUrl": "true",
            "NextToken": "[@Tables.Activities.@.nextPageToken]",
            "QueryParameters": {
            "nextPageToken": "[@Tables.Activities.@.nextPageToken]"
            }
        },
        "Body": {},
        "DataPath": "result"
        }
    ]
}