-
Notifications
You must be signed in to change notification settings - Fork 1
/
rest-api.js
33 lines (28 loc) · 1.1 KB
/
rest-api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var request= require('request');
const jar = request.jar();
const axelor = "http://localhost:8786";
request.post({
url: axelor+'/callback',
json: { username:'admin',password:'admin'},
headers: {
"content-type": "application/json",
},
jar
},
(error, response, body)=> {
if(error) console.warn(error);
console.dir(response.statusCode);
request({
url: axelor+'/ws/rest/com.axelor.apps.account.db.Account',
method:"GET",
jar
},
(error, response, body)=>{
if (!error && response.statusCode == 200) {
var rows = JSON.parse(body).data ;
for(var n=0;n<rows.length;n++){
console.dir(rows[n].name);
}
}
});
});