Kynetx Network Services (KNS) API

From KynetxDocs

Jump to: navigation, search

Contents

Initialization (/js/)

  • initialize (/js/shared/kobj-static.js) - Load shared libraries
  • initialize (/js/static/kobj-static.js) - Synonym for /js/shared/kobj-static.js. (decprecated)
  • initialize (/js/<ruleset-id>;<ruleset-id>;...<ruleset-id>/kobj.js) - Client specific library. Parameters:
    • dataset - Client specific data to be loaded for this user.
    • param - any other parameter. If more that one ruleset ID is given, parameters may be given a namespace equal to the RID. Namespaces and parameter names are separated by a colon.
  • dispatch (/js/dispatch/<ruleset-id>;<ruleset-id>;...<ruleset-id>/) - return list of sites that the subject rulesets act on.
  • datasets (/js/datasets/<ruleset-id>;<ruleset-id>;...<ruleset-id>/) - return a Javascript program that defines the datasets for this ruleset.
  • version (/js/version/<ruleset-id>) - Return the current build of service.
    Parameters:
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.

Ruleset

The following methods are available for rulesets:

  • eval (/ruleset/eval/<ruleset-id>) - evaluate the ruleset with ID <ruleset-id>
    Parameters:
    • caller - the URL of the page that the ruleset is run against
    • referer - the URL of the refering page to the caller
    • kvars - any kvars set on the page
    • title - the title of the caller
    • mode - if set to 'test' then rules with rule state equal to test will be evaluated along with active rules.
  • flush (/ruleset/flush/<ruleset-id>) - flush the ruleset with ID <ruleset-id> from the cache.
  • console (/ruleset/console/<ruleset-id>) - display a debugging console for ruleset with ID <ruleset-id>.
  • describe (/ruleset/describe/<ruleset-id>) - display description and other meta data for ruleset with ID <ruleset-id>.
    Parameters:
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.
  • version (/ruleset/version/<ruleset-id>) - display version information for service
    Parameters:
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.

Not implemented yet:

  • /ruleset/get/<ruleset-id>
  • /ruleset/get/<ruleset-id>/rule/<rule-name>
  • /ruleset/put/<ruleset-id>

Callback

  • /callback/<ruleset-id> - log a callback event.
    Parameters:
    • url
    • caller
  • version (/callback/version/) - display version information for service
    Parameters:
    • <tt>flavor - What flavor of data to return. Valid values are html and json. Defaults to html.

Management

  • validate (/manage/validate/) - depricated in favor of parse method. validate and parse ruleset
    Parameters:
    • rule - Which ruleset to validate.
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.
  • jsontokrl (/manage/jsontokrl/) - return the KRL for a given JSON parsetree
    Parameters:
    • type - If set to bodyonly, expects the body of a rule, otherwise expects a full ruleset.
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.
  • version (/manage/version/<ruleset-id>) - display version information for service
    Parameters:
    • flavor - What flavor of data to return. Valid values are html and json. Defaults to html.

parse

KRL parser. This method has submethods as follows.
Each submethod takes identical parameters:

    • krl - KRL to parse.
  • parse/ruleset (/manage/parse/ruleset) - KRL parser for a complete ruleset
  • parse/rule (/manage/parse/rule) - KRL parser for a single rule
  • parse/global (/manage/parse/global) - KRL parser for the global declarations
  • parse/dispatch (/manage/parse/dispatch) - KRL parser for the dispatch directive
  • parse/meta (/manage/parse/meta) - KRL parser for the meta directive

An error will be returned in a hash (record) with the key 'error'.

{"error" : "Something bad happened"}

You must use a POST to submit this.

unparse

KRL unparser. This method has submethods as follows.
Each submethod takes identical parameters:

    • ast - Abstract syntax tree (expressed as JSON) to unparse.
  • unparse/ruleset (/manage/unparse/ruleset) - KRL unparser for a complete ruleset
  • unparse/rule (/manage/unparse/rule) - KRL unparser for a single rule
  • unparse/global (/manage/unparse/global) - KRL unparser for the global declarations
  • unparse/dispatch (/manage/unparse/dispatch) - KRL unparser for the dispatch directive
  • unparse/meta (/manage/unparse/meta) - KRL unparser for the meta directive

Analytics

  • TBD
Personal tools