concept API { match '*restapi*' plugin rest " /getPages => getPages " } concept getPages { plugin rest:json[flowName = 'json'] flow (json) => sql['select * from Pages',`database`,limit='100',batch='1'] => out }
curl -H "Content-Type: application/json" --referer http://www.domain.nl/restapi?dimml=sandbox/d994df195bd2129815029892f0df11f4439c14ee http://baltar-dev.dimml.io/getPages
Add the following code to the sandbox
concept restAPI { match '*restapi*' plugin rest " /create => restCreate " } concept restCreate extends dataExtension { plugin rest:json[flowName = 'json'] flow (json) => nop (extend) flow (extendIn) => out } concept dataExtension { flow (extend) => code [views=`1`] => nop (extendIn) } concept all extends dataExtension { match '*' val versions = 'v2' flow => nop (extend) flow (extendIn) => debug plugin debug }
Also the last concept will be used for handling clickstream interactions. This concept also uses the data extension concept
curl -H "Content-Type: application/json" -X POST --data "{\"calltype\":\"restapi\"}" --referer http://www.domain.nl/restapi?dimml=sandbox/d994df195bd2129815029892f0df11f4439c14ee http://baltar-dev.dimml.io/create
[{“calltype”:”restapi”,”view”:”1”,”sql_count”:”1”}]
Extend the restAPI such that the total number of views for each calltype is available. The new concept should look something like this
concept restRetrieve { plugin rest:json[flowName = 'json'] flow (json) => sql['select calltype,SUM(views) from calltypes GROUP BY calltype',`dataSource`,limit='100',batch='1'] => filter['result'] => split['result'] => out } const dataSource = `{ type: 'mysql', port: 3306, serverName: 'dimml-train.o2mc.io', databaseName: 'dimml_training', user: 'control', password: '963paarsOranje51' }`