Merge branch 'je' into 'main'
add file emergency_api.js See merge request !3
Showing
1 changed file
with
19 additions
and
0 deletions
emergency_api.js
0 → 100644
1 | +const request = require('request'); | ||
2 | +const convert = require("xml-js"); | ||
3 | + | ||
4 | +var url = 'http://apis.data.go.kr/B552657/ErmctInfoInqireService/getEmrrmRltmUsefulSckbdInfoInqire'; | ||
5 | +var queryParams = '?' + encodeURIComponent('serviceKey') + '=52tXHgaW46YUpGn9k0r3IQrduIl6kBOl3Ta8Idra1%2BpPMYhL4qVCDu9itW8FVbDtMF4f9LAT9NJXEx7pvEJv%2FQ%3D%3D'; /* Service Key*/ | ||
6 | +queryParams += '&' + encodeURIComponent('STAGE1') + '=' + encodeURIComponent('¼¿ïƯº°½Ã'); /* */ | ||
7 | +queryParams += '&' + encodeURIComponent('STAGE2') + '=' + encodeURIComponent('°³²±¸'); /* */ | ||
8 | +queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ | ||
9 | +queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('10'); /* */ | ||
10 | + | ||
11 | +request({ | ||
12 | + url: url + queryParams, | ||
13 | + method: 'GET' | ||
14 | +}, function (err, res, body) { | ||
15 | + if(err){ | ||
16 | + console.log(`err => ${err}`) | ||
17 | + } | ||
18 | + console.log(convert.xml2js(body)); | ||
19 | +}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment