How to call your created WebApis

I believe you know ajax function whichever in server and on client, whatever programing languages.
Therefore I just show you a sample code first.

Ⅰ.Case Study in PostgreSQL/MySql
Ⅱ.Case Study in Redis
Ⅲ.Case Study in MongDB



Ⅰ.Case Study in PostgreSQL/MySql
Case 1:
in case of kicking ‘insert’ api
table name: ftest
require columns: ftest_name, ftest_age, ftest_ave
api name: ‘ji9’
IN: {“apino”:”ji9″,”ftest_name”:”Jhon”,”ftest_age”:26,”ftest_ave”:0.86}
OUT: {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution sql: insert into ftest (ftest_name,ftest_age,ftest_ave) values(‘Jhon’,26,0.86);

const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "ji9";
        pd["ftest_name"] = "Jhon";
        pd["ftest_age"] = 26;
        pd["ftest_ave"] = 0.86;

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Case 2:
in case of kicking ‘select’ api
table name: ftest
require columns: ftest_jt_id, ftest_name, ftest_age, ftest_ave
api name: ‘js10’
IN: {“apino”:”js10″,”subquery”:”[‘age’:30]”}
OUT: {“result”:true or false, “Jetelina”:”[{“ftest_jt_id”:”{ftest_jt_id}”,”ftest_name”:”{ftest_name}”,”ftest_age”:”{ftest_age}”,”ftest_ave”:”{ftest_ave}”,”message from Jetelina”:””…..””}
execution sql: select ftest.ftest_jt_id,ftest.ftest_name,ftest.ftest_age,ftest.ftest_ave from ftest as ftest where ftest.ftest_age < 30;

const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "js10";
        pd["subquery"] = "['age':30]";       ← attention at here

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Case 3:
in case of kicking ‘update’ or ‘delete’ api
table name: ftest
require columns: ftest_jt_id, ftest_name, ftest_age, ftest_ave
api name: ‘ju11’ for ‘update’ or ‘jd12’ for ‘delete’
IN: {“apino”:”ju11″,”ftest_name”:”Jhon”,”ftest_age”:26,”ftest_ave”:0.86,”subquery”:46}
{“apino”:”jd12″,”subquery”:46}
OUT: {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution sql: update ftest set ftest_name=’Jhon’, ftest_age=26, ftest_ave=0.86 where ftest_jt_id=46;
update ftest set jetelina_delete_flg=1 where ftest_jt_id=46;

you can see, the ‘delete’ does not do physical deleting, it just makes it inaccessable by seting ‘jetelina_delete_flg’, then Jetelina clean up these hidden data later.

★in case of update api 'ju11'
const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "ju11";
        pd["ftest_name"] = "Jhon";
        pd["ftest_age"] = 26;
        pd["ftest_ave"] = 0.86;
        pd["jt_id"] = 46;            ← attention at here

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

★in case of delete api 'jd12'
const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "jd12";
        pd["jt_id"] = 46;         ← attention at here

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Ⅱ.Case Study in Redis
Attention: there is no api for deleting a key data.

Case 1:
in case of ‘insert’ api
inserting data in Redis is inhibit by using ajax. you can do it only on Jetelina.

Case 2:
in case of kicking ‘select’ api
key name: Jhonsaccesstimes
api name: ‘js20’ for ‘select’
IN: {“apino”:”js20″}
OUT: {“result”:true or false, “Jetelina”:”[{“Jhonsaccesstimes”:”{value data}”}]”,”message from Jetelina”:””…..””}
execution: get jhonsaccesstimes

const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "js20";

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Case 3:
in case of kicking ‘update’ api
key name: Jhonsaccesstimes
value: 100
api name: ‘ju21’ for ‘update’
IN: {“apino”:”ju21″,”key”:”100″}
OUT: {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution: get jhonsaccesstimes

const getAjaxData = (s) => {
        let pd = {};

        pd["apino"] = "ju20";
        pd["Jhonsaccesstimes"] = "100";

        let dd = JSON.stringify(pd);
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Ⅲ.Case Study in MongoDB
Case 1:

in case of kicking ‘insert’ api
document name: newdoc1
api name: ‘ji30’
IN: {“apino”:”ji30″,”new document”:{“j_table”:”newdoc1″,”name”:”Jhon”,”age”:26,”ave”:0.86}
OUT: {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution: inserting

const getAjaxData = (s) => {
        let dd = '{"apino":"ji30","new document":{"j_table":"newdoc1","name":"jhon","age":"26","ave":"0.86"}}';
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Case 2:
in case of kicking ‘select’ or ‘delete’ api
api name: ‘js31’ for ‘select’ or ‘jd32’ for ‘delete’
IN: {“apino”:”js31″}
{“apino”:”jd32″}
OUT: ‘selecting’ [“{ \”_id\” : { \”$oid\” : \”…..\” }, \”j_table\” : \”newdoc1\”, \”name\” : \”jhon\”, \”age\” : \”26\”, \”ave\” : \”0.86\” }”]
‘deleting’ {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution: selecting or deleting

const getAjaxData = (s) => {
        let dd = '{"apino":"js31"}';
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

Case 3:
in case of kicking ‘update’ or ‘delete’ api
api name: ‘ju33’
IN: {“apino”:”ju33″:”age”:”36″}
OUT: {“result”:true or false, “Jetelina”:”[{}]”,”message from Jetelina”:””…..””}
execution: updating ‘age’

const getAjaxData = (s) => {
        let dd = '{"apino":"ju33","age":"36"}';
        let url = "http://localhost:8000/apiactions"
        $.ajax( {
            url: url,
            type: "post",
            data: dd,
            contentType: 'application/json',
            dataType: "json",
        }).done(function(result, textStatus, jqXHR) {
        }).fail( function( result ){
        }).always(function(result){
        });
    }

You know ‘apiactions’ is the callable webapi name, you throw your Json form of api forward to this webapi.
Indeed, this webapi has alternative name; ‘plzjetelina’ and ‘executionapi’, work as same as ‘apiactions’.