API Docs for:
Show:

plugin_rest_custcard Class

Module: plugins_rest
Parent Module: com_customer_card_rest

REST plugin that provides customer card functions through the following REST API:

GET requests

  1. custcard/getbynum/:number/:format
  2. custcard/list

custcard/getbynum/:number/:format

The client receive all customer cards by number for which he has the permission. The data key contains the customer card in the specified format: if the format is html the data will be base64 encoded. The parameters are:

  • number: the number to use to search the customer cards data
  • format: ("json" | "html") the format of the received "data" key

Example JSON response:

{
    "cc_identity": {
         "descr": "Customer Identity",
         "data": "PCEtLSBjb2xvcjogcmVk...",
         "number": "0721405516"
    }
}

list

Return the list of the customer cards with their descriptions.

Example JSON response:

{
    "cc_identity": {
         "descr": "Customer Identity",
    },
    ...
}

POST requests

  1. custcard/preview

custcard/preview

Returns the customer card as base64 encoded html data.

  • dbconn_id: the identifier of the database source
  • template: the name of the template file.
  • query: the query to be executed to get the data to be rendered with template. Must be base64 encoded

Example JSON request parameters:

{ "dbconn_id": "1", "template": "template_name", "query": base64("select * from db") }

Example JSON response:

{
    "html": "PCEtLSBjb..."
}

Methods

getbynum

(
  • req
  • res
  • next
)

Searches the customer cards by number with the following REST API:

getbynum/:number/:format

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

list

(
  • req
  • res
  • next
)

Return the list of the customer cards with the following REST API:

list

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

preview

(
  • req
  • res
  • next
)

Returns the customer card as base64 encoded html data.

preview

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

setCompCustomerCard

(
  • cc
)

Set customer card architect component used by customer card functions.

Parameters:

  • cc Object

    The customer card architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

compCustomerCard

Object private

The customer card architect component used for customer card functions.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • list String

    Return the list of the customer cards.

  • getbynum/:number/:format String

    To get a customer card as base64 encoded html format.

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/custcard]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • preview String

    To get the customer card by specified number and data.