KDF APIs

From KallestadWiki

Jump to: navigation, search

Contents

Command Objects

Command Objects include the following:

do  => command to run
out => output format (json,xml,text,html,or appropriate user defined values)
pv  => appropriate parameter values for the given command

Named Queries

Executing a named query remotely:

do command : nq
pv object  :
                 name   : Name of Query to Execute
                 params : Parameter List for named query
                 nqout  : array or null (if array, the response does not include hashed column titles)

Alternatively for a strict SOAP request:

do command : nq
name       : Name of Query to Execute
nqout      : array or null (if array, the response does not include hashed column titles)
p1 ... pn  : Parameter List for named query

Response Object:

For most queries, the expected result is an array of hashes - where each item in the array represents a database record. Each key in the hash is a column name, each value in the hash is the column value.

If the 'out' parameter was specified as "array", the expected result is an array of arrays.

If a query returns zero results, the response state is set to 'warn', with the Error String set to "no results".

If a query is not supposed to return results, the results object will contain some sort of appropriate response (such as 'query executed', or '5 records deleted')

SQL

This section got a little big, so it was moved to a new page.


Web Service

There are two ways to define and interact with web services - either via Proxied Web Services, where results are pushed directly and the KDF Framework acts as a blind proxy and cacheing mechanism, or with Workflow Transformed Services, where results are obtained and transformed vie the KDF Framework.

Proxied Web Services can be tranformed in data format - from XML to JSON and vice versa.

Proxied Direct Services

Workflow Transformed Services

KDF Objects

KDF Objects are data objects that are consumed and transformed by workflow elements before being committed to the database.

KDF Objects are also subject to permission structures that define user access on a variety of levels.

QBE

Query By Example

Query By Example interactions are

New

Update

Delete

Response Objects

Unless you are working with a customized API set, response objects are always the same - regardless of whether or not you are working with XML or JSON data structures. (XML response objects are simple XML elements with no attributes)

status = OK, Error, or Warn
errors = array of errors (present if there is an error, otherwise not defined)
  errno   = Error Number 
  errstr  = Error String 
result = Appropriate Result String or resulting object from a command

For instance, if your command was to run a query, and that query returned three records, the object would look like this:

Status => OK
Results => [
            {name => 'fred', eyes => 'brown'},
            {name => 'lisa', eyes => 'blue'},
            {name => 'bill', eyes => 'green'}
           ]

Of course, the object would be syntax appropriate for either JSON or XML depending on your desired output.

Kallestad Development Framework Topics

Personal tools