26 lines
541 B
JavaScript
26 lines
541 B
JavaScript
|
|
/* (1) Création de l'instance d'API */
|
|
var api = new API("http://ndli1718/api/v/1.0/");
|
|
|
|
|
|
|
|
|
|
/* (2) Premier appel (tout dans url) */
|
|
// method uriuriuriuriuriuriuri fo handlerhandlerhandl
|
|
api.call('GET RESTexample/article/4', {}, function(response){
|
|
|
|
console.log(response);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* (3) Premier appel (url+formdata) */
|
|
|
|
// method uriuriuriuriuriuriuri formdataformdataformdataformda handlerhandlerhandl
|
|
api.call('PUT RESTexample/article/1', { content: 'nouveau contenu' }, function(response){
|
|
|
|
console.log(response);
|
|
|
|
}); |