1.1.5 • Published 1 year ago
form-service-api v1.1.5
API endpoints for FormService ※ choose operator here: '>', '>=', '<', '<=', '=', 'contains';
- Form
1.1. post
- Endpoint: FormService.post(data, form_type)
- Params:
#data:
type:json, value: { target_field:'', data:{...} } ex:{ target_field: '$.Computer.Dell', data: { name: 'Dell', detail: { price: 10000, color: 'red', } }, }, #form_type: type: String, value:'form' - Description: Store form data on the blockchain.
1.2. getAll
- Endpoint: FormService.getAll(form_type)
- Params: #form_type: type:String, value:'form'
- Return: Array of Object
- Description: Return all form data stored on the blockchain.
1.3. getOne
- Endpoint: FormService.getOne(target_field, form_type)
- Params: #target_field: type:String, value:"" ex:'$.Computer.Hp' #form_type: type:'form'
- Return: Object
- Description: Return certain form data according to target_field on the blockchain
1.4. getMany
- Endpoint: FormService.getMany(filter_array, form_type)
- Params: #filter_array: type:Array of Object, value:{key:'', operator:'', value:''}, {....} ex: {key: 'price', operator: '>=', value: '100'}, {key: 'price', operator: '<=', value: '500'}, #form_type: type:String, value:'form'
- Return: Array of Object
- Description: Return several form data according to filter array on the blockchain
1.5. putOne
- Endpoint: FormService.putOne(data, form_type)
- Params: #data: type:json, value:{ target_field:'', data:{key:'', value:''}, {...} } ex: { target_field: '$.Computer.Dell', data: {key: 'price', value: '200'}, {key: 'color', value: 'red'}, , }, #form_type: type:String, value:'form'
- Return: True / False
- Description: Update one form data according to target_field on the blockchain
1.6. putMany
- Endpoint: FormService.putMany(find_array, set_array, form_type)
- Params: #find_array: type: Array of Object, value:{key:'', operator:'', value:''}, {...} ex: {key: 'price', operator: '>=', value: '100'}, {key: 'price', operator: '<=', value: '500'}, #set_array: type: Array of Object, value:{key:'', operator:'', value:''}, {...} ex: {key: 'price', operator: '>=', value: '100'}, {key: 'price', operator: '<=', value: '500'}, #form_type: type:String, value:'form'
- Return: True / False
- Description: Update several form data according to filter array on the blockchain
1.7. deleteOne
- Endpoint: FormService.putMany(target_field, form_type)
Params: #target_field: type: String, value:'' ex:'$.Computer.Dell'
#form_type: type:String, value:'form'
Return: True / False
- Description: Delete certain form data according to target_field on the blockchain
1.8. deleteMany
- Endpoint: FormService.deleteMany(filter_array, form_type)
- Params: #filter_array: type: Array of Object, value:{key:'', operator:'', value:''}, {...} ex: {key: 'price', operator: '>=', value: '10'}, {key: 'price', operator: '<=', value: '100'} #form_type: type:String, value:'form'
- Return: True / False
- Description: Delete several json data according to filter array
1.9. deleteAll
- Endpoint: FormService.deleteAll(form_type)
- Params: #form_type: type:String, value:'form'
- Return: True / False
- Description: Delete all form data on the blockchain
- Function
2.1. post
- Endpoint: FormService.post(data, form_type)
- Params: #data: type:json, value:{ name:'', data:{ category:'', library:'', name:'', params:[], return_type:'' } } ex: { name: 'function2', data: { category: 'Logistics', library: 'Standard', name: 'Greater than', params: [ '20', { category: 'Math', library: 'Standard', name: 'Sum', params: '25', '30', return_type: 'numeric' }, ], return_type: 'numeric', } }, #form_type: type:String, value:'function'
- Description: Store function on the blockchain
2.2. getOne
- Endpoint: FormService.getOne(function_name, form_type)
- Params: #function_name: type:String, value:'' ex:'function2' #form_type: type:String value:'function'
- Return: Object
- Description: Return a function according to given name on the blockchain
2.3. getAll
- Endpoint: FormService.getAll(form_type)
- Params: #form_type: type:String, value:'function'
- Return: Array of Object
- Description: Return all functions on the blockchain
2.4. putOne
- Endpoint: FormService.putOne(data, form_type)
- Params:
#data:
type:json,
value:{
id: int,
name:'',
data:{
category:'',
library:'',
name:'',
params:[],
return_type:''
}
}
ex:
{
id:0, name: 'function3', data: { category: 'Logistics', library: 'Standard', name: 'Greater than', params: [ '20', { category: 'Math', library: 'Standard', name: 'Sum', params: '25', '30', return_type: 'numeric', }, ], return_type: 'numeric', }, }, #form_type: type:String, value:'function' - Return: True/False
- Description: Update one function according to given name on the blockchain
2.5. deleteOne
- Endpoint: FormService.deleteOne(function_name, form_type)
Params: #function_name: type:String, value:'' ex:'function3'
#form_type: type:String, value:'function'
Return: True / False
- Description: Delete one function according to given name on the blockchain
2.6. deleteAll
- Endpoint: FormService.deleteAll(form_type)
- Params: #form_type: type:String, value:'function'
- Return: True / False
- Description: Delete all functions on the blockchain
2.7. runFunction
- Endpoint: FormService.runFunction(full_function)
- Params: #full_function: type:String, value:'' ex:'SumOfPrices(10,20,30)'
- Description: Calcualte function on the blockchain
- Rule
3.1. post
- Endpoint: FormService.post(data, form_type)
- Params: #data: type:json, value:{ name:'', condition:{ left:int, operator:'', right:{ category:'', library:'', name:'', params:[], return_type:'' }/int }, actions:[ { action_type:'', target_field:'', filter:{}/{key:'', operator:'', value:''} data:{key:'', value:''} },.... ] } ex: { name: 'rule_1', condition: { left: 100, operator: '>', right: { category: 'Math', library: 'Standard', name: 'Sum', params: '20', '30', return_type: 'numeric', }, }, actions: [ { action_type: 'Put', target_field: '', filter: { key: 'price', operator: '>', value: 'SumOfPrices(10, 20, 400)', }, , data: {color: 'grey'}, }, ], }, #form_type: type:String, value:'rule'
- Description: Store a JSON data for rule on the blockchain.
3.2. getAll
- Endpoint: FormService.getAll(form_type)
- Params: #form_type: type:String, value:'rule'
- Return: Array of Object
- Description: Return all rules on the blockchain
3.3. getOne
- Endpoint: FormService.getOne(rule_name, form_type)
- Params: #rule_name: type:String, value:'' ex:'rule_1' #form_type: type:String, value:'rule'
- Return: Object
- Description: Return one rule according to given name on the blockchain
3.4. putOne
- Endpoint: FormService.putOne(data, form_type)
- Params:
#data:
type:json,
value:{
id:int, name:'', condition:{ left:int, operator:'', right:{ category:'', library:'', name:'', params:[], return_type:'' }/int }, actions:[ { action_type:'', target_field:'', filter:{}/{key:'', operator:'', value:''} data:{key:'', value:''}
#form_type: type:String, value:'rule'},{...} ] } ex: { name: 'rule_1', condition: { left: 100, operator: '>', right: { category: 'Math', library: 'Standard', name: 'Sum', params: ['20', '30'], return_type: 'numeric', }, }, actions: [ { action_type: 'Put', target_field: '', filter: [ { key: 'price', operator: '>', value: 'SumOfPrices(10, 20, 400)', }, ], data: {color: 'grey'}, }, ], },
- Return: True/False
- Description: Update certain rule according to given id on the blockchain
3.5. deleteOne
- Endpoint: FormService.deleteOne(rule_name, form_type)
- Params: #rule_name: type:String, value:'', ex:'rule_1' #form_type: type:String, value:'rule'
- Return: True/False
- Description: Delete certain rule according to given name on the blockchain
3.6. deleteAll
- Endpoint: FormService.deleteAll(form_type)
- Params: #form_type: type:String, value:'rule'
- Return: True / False
- Description: Delete all rules on the blockchain
3.7 runRule
- Endpoint: FormService.runRule(id)
- Params: #id: type:int, value: ex:0, 1...
- Description: Run rule and invokes all actions according to id on the blockchain
1.1.5
1 year ago