Merge branch 'je' into 'main'
Je See merge request !10
Showing
1 changed file
with
6 additions
and
10 deletions
| 1 | -const { query } = require('express'); | ||
| 2 | const express = require('express'); | 1 | const express = require('express'); |
| 3 | const app = express(); | 2 | const app = express(); |
| 4 | const request = require('request'); | 3 | const request = require('request'); |
| 5 | const convert = require("xml-js"); | 4 | const convert = require("xml-js"); |
| 6 | 5 | ||
| 7 | -var url = 'http://apis.data.go.kr/B552657/ErmctInfoInqireService/getEmrrmRltmUsefulSckbdInfoInqire'; | 6 | +var url = 'http://apis.data.go.kr/B552657/ErmctInfoInqireService/getSrsillDissAceptncPosblInfoInqire'; |
| 8 | var queryParams = '?' + encodeURIComponent('serviceKey') + '=52tXHgaW46YUpGn9k0r3IQrduIl6kBOl3Ta8Idra1%2BpPMYhL4qVCDu9itW8FVbDtMF4f9LAT9NJXEx7pvEJv%2FQ%3D%3D'; /* Service Key*/ | 7 | var queryParams = '?' + encodeURIComponent('serviceKey') + '=52tXHgaW46YUpGn9k0r3IQrduIl6kBOl3Ta8Idra1%2BpPMYhL4qVCDu9itW8FVbDtMF4f9LAT9NJXEx7pvEJv%2FQ%3D%3D'; /* Service Key*/ |
| 9 | 8 | ||
| 10 | -queryParams += '&' + encodeURIComponent('STAGE1') + '=' + '%EC%84%9C%EC%9A%B8%ED%8A%B9%EB%B3%84%EC%8B%9C'; /* */ | 9 | +queryParams += '&' + encodeURIComponent('STAGE1') + '=' + encodeURIComponent('¼¿ïƯº°½Ã'); /* */ |
| 11 | -queryParams += '&' + encodeURIComponent('STAGE2') + '=' + '%EA%B0%95%EB%82%A8%EA%B5%AC'; /* */ | 10 | +queryParams += '&' + encodeURIComponent('STAGE2') + '=' + encodeURIComponent('°³²±¸'); /* */ |
| 11 | +queryParams += '&' + encodeURIComponent('SM_TYPE') + '=' + encodeURIComponent(''); /* */ | ||
| 12 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ | 12 | queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('1'); /* */ |
| 13 | queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('10'); /* */ | 13 | queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('10'); /* */ |
| 14 | 14 | ||
| 15 | -console.log(url+queryParams); | ||
| 16 | - | ||
| 17 | request({ | 15 | request({ |
| 18 | url: url + queryParams, | 16 | url: url + queryParams, |
| 19 | method: 'GET' | 17 | method: 'GET' |
| ... | @@ -23,10 +21,8 @@ request({ | ... | @@ -23,10 +21,8 @@ request({ |
| 23 | } | 21 | } |
| 24 | else{ | 22 | else{ |
| 25 | var result = body | 23 | var result = body |
| 26 | - console.log(`body data => ${result}`) | 24 | + var xmlTojson = convert.xml2json(result, {compact: true, spaces:1}); |
| 27 | - var xmlTojson = convert.xml2json(result, {compact: true, spaces:4}); | 25 | + console.log(xmlTojson) |
| 28 | - console.log(`xml to json => ${xmlTojson}`) | ||
| 29 | } | 26 | } |
| 30 | - | ||
| 31 | } | 27 | } |
| 32 | ); | 28 | ); |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment