node-red-contrib-xmysql
A Node-RED node to get response to xmysql api .
Install
Run the following command in the root directory of your Node-RED install:
npm install node-red-contrib-xmysql
Usage
xmysql API
xmysql api request node.
Expects a msg.payload with request(get,post,put,patch,delete) params.
API Overview
HTTP Type | API URL | Comments |
---|---|---|
GET | / | Gets all REST APIs |
GET | /api/tableName | Lists rows of table |
POST | /api/tableName | Create a new row |
PUT | /api/tableName | Replaces existing row with new row |
POST 🔥 | /api/tableName/bulk | Create multiple rows - send object array in request body |
GET 🔥 | /api/tableName/bulk | Lists multiple rows - /api/tableName/bulk?_ids=1,2,3 |
DELETE 🔥 | /api/tableName/bulk | Deletes multiple rows - /api/tableName/bulk?_ids=1,2,3 |
GET | /api/tableName/:id | Retrieves a row by primary key |
PATCH | /api/tableName/:id | Updates row element by primary key |
DELETE | /api/tableName/:id | Delete a row by primary key |
GET | /api/tableName/findOne | Works as list but gets single record matching criteria |
GET | /api/tableName/count | Count number of rows in a table |
GET | /api/tableName/distinct | Distinct row(s) in table - /api/tableName/distinct?_fields=col1 |
GET | /api/tableName/:id/exists | True or false whether a row exists or not |
GET | /api/parentTable/:id/childTable | Get list of child table rows with parent table foreign key |
GET 🔥 | /api/tableName/aggregate | Aggregate results of numeric column(s) |
GET 🔥 | /api/tableName/groupby | Group by results of column(s) |
GET 🔥 | /api/tableName/ugroupby | Multiple group by results using one call |
GET 🔥 | /api/tableName/chart | Numeric column distribution based on (min,max,step) or(step array) or (automagic) |
GET 🔥 | /api/tableName/autochart | Same as Chart but identifies which are numeric column automatically - gift for lazy while prototyping |
GET 🔥 | /api/xjoin | handles join |
GET 🔥 | /dynamic | execute dynamic mysql statements with params |
GET 🔥 | /upload | upload single file |
GET 🔥 | /uploads | upload multiple files |
GET 🔥 | /download | download a file |
GET | /api/tableName/describe | describe each table for its columns |
GET | /api/tables | get all tables in database |
GET | /_health | gets health of process and mysql -- details query params for more details |
GET | /_version | gets version of Xmysql, mysql, node |
API URL
- The url to call the xmysql API.
method
- Http Request Method
parameter example
# GETmsgmethod = 'get';// msg.payload.id = '1598617946';msgpayloadapi = 'exists';msgpayloadapi = 'findOne';msgpayloadapi = 'count';msgpayloadapi = 'distinct';msgpayloadapi = 'groupby';msgpayloadapi = 'ugroupby';msgpayload'_fields' = 'it_name';// _fields=it_price&min=0&max=10000&step=1000msgpayloadapi = 'chart';msgpayload'_fields' = 'it_price';msgpayload'min' = '0';msgpayload'max' = '10000';msgpayload'step' = '1000';msgpayloadapi = 'aggregate'; # POSTmsgmethod = 'post'msgpayloadprice = '300';msgpayloadtax = '30'; # PUTmsgmethod = 'put'msgpayloadid = '2';msgpayloadprice = '400';msgpayloadtax = '40'; # DELETEmsgmethod = 'delete'msgpayloadid = '2';
sample flow