Strumenti Utente

Strumenti Sito


apireference:esempi_uso

Sommario

Esempi di uso

Caricamento del Manifest

const axios=require('axios'); let response=await axios.get('https://pim.neosidea.com/api/manifest.json'); if(typeof(response.data['error'])=='undefined' && typeof(response.data['error']['code'])=='undefined');else{alert(response.data.error.description);return;} let manifest=response.data; console.log('Caricato il microservizio: '+manifest.code);

Generazione

let response=await axios.get(manifest.schema.product.api.new.url+'2'); if(typeof(response.data['error'])=='undefined' && typeof(response.data['error']['code'])=='undefined');else{alert(response.data.error.description);return;} let newobjects=response.data.result;

Commit/Salvataggio

let response=await axios.post(manifest.schema.product.api.save.url,[ {

 uuid: newobjects[0].uuid,
 name:'Prova 1',
 price:7.99,
 year,2019,
 commit:1

}, {

 uuid: newobjects[1].uuid,
 name:'Prova 2',
 price:11.99,
 year,2016,
 commit:1

} ]); if(typeof(response.data['error'])=='undefined' && typeof(response.data['error']['code'])=='undefined');else{alert(response.data.error.description);return;}

Ricerca

let response=await axios.post(manifest.schema.product.api.search.url,{query:“Prova”,filter:{func:“and”,fields:[{field:“price”,func:“gt”,value:0},{field:“year”,func:“lt”,value:2020}]},format:“related”,sortby:{field:“name”,desc:false},offset:0,limit:manifest.config.search_max}); if(typeof(response.data['error'])=='undefined' && typeof(response.data['error']['code'])=='undefined');else{alert(response.data.error.description);return;} let newobjects=response.data.result;

Caricamento

let response=await axios.post(manifest.schema.product.api.load.url,[newobjects[0].uuid,newobjects[1].uuid]); if(typeof(response.data['error'])=='undefined' && typeof(response.data['error']['code'])=='undefined');else{alert(response.data.error.description);return;} let newobjects=response.data.result;

apireference/esempi_uso.txt · Ultima modifica: 2024/04/08 15:28 da marcomerlino