정부혜택 정보 (API 구현)
수출바우처 지원중소벤처기업진흥공단
서비스분야고용·창업
신청방법기타 온라인신청
신청기한(1차) 2025. 12. 17. ~ 2026. 1. 9., (2차) 2026. 4. 17 ~ 2026. 5. 6., (3차) 2026.6월 예정
자세히 보기로직 설명
- API URL - https://api.odcloud.kr/api/gov24/v3/serviceList
- serviceKey - authkey ( 참고 : https://www.data.go.kr/data/15113968/openapi.do )
- 파라미터
- 등록일시(이상) : cond[등록일시::GTE]
- 등록일시(이하) : cond[등록일시::LTE]
- 소관기관유형 : cond[소관기관유형::LIKE]
- 기타 파라미터 : https://www.data.go.kr/data/15113968/openapi.do 참고
- 사용한 로직
/** * 정부혜택 서비스 관련 API */ export class PublicService { /** * @param {string} authkey - data.go.kr 인증 키 */ constructor(authkey) { this.authkey = authkey; } async getList(opts) { const { startDate, endDate, page=1, perPage=9, organ } = opts; let conds = []; if(startDate) { const strDate = DateUtil.format('yyyyMMdd', startDate); conds.push(encodeURIComponent('cond[등록일시::GTE]')+`=${strDate}`); } else { const date = new Date(); date.setFullYear(date.getFullYear() - 1); date.setMonth(0); date.setDate(1); const strDate = DateUtil.format('yyyyMMdd', date); conds.push(encodeURIComponent('cond[등록일시::GTE]')+`=${strDate}`); } if(endDate) { const strDate = DateUtil.format('yyyyMMdd', endDate); conds.push(encodeURIComponent('cond[등록일시::LTE]')+`=${strDate}`); } if(organ) { conds.push(encodeURIComponent('cond[소관기관유형::LIKE]')+`=${organ}`); } const cond = conds.join('&'); const fetchUrl = 'https://api.odcloud.kr/api/gov24/v3/serviceList'; const url = `${fetchUrl}?serviceKey=${this.authkey}&page=${page}&perPage=${perPage}&${cond}`; const res = await fetch(url, { headers: { 'accept': 'application/json' } }); if (!res.ok) { throw new Error('API 응답 실패'); } return await res.json(); } }