/neis-api.ts

NEIS Open API Wrapper for TypeScript

Primary LanguageTypeScriptMIT LicenseMIT

neis-api.ts

License npm

TypeScript-based NEIS OPEN API wrapper

Features

πŸ”§ Full TypeScript support

πŸš€ Simple method calls

πŸ“Š Performance stats

🎯 12 NEIS endpoints

Install

npm install neis-api.ts
yarn add neis-api.ts
pnpm add neis-api.ts

Version 1.7.0 >=

const neis = new NeisApi({
  key: NEIS_API_KEY,
  stats: true, // Activate using true
});

// [API Http Stats - Endpoint: schoolInfo | Response Time: 251ms] <-- API call and response time output function

Endpoints

Basic Argument

λ³€μˆ˜λͺ… νƒ€μž… λ³€μˆ˜ μ„€λͺ… μ„€λͺ…
key STRING(ν•„μˆ˜) 인증킀 κΈ°λ³Έκ°’ : ❌
type STRING(선택) 호좜 λ¬Έμ„œ(xml, json) κΈ°λ³Έκ°’ : json
pIndex INTEGER(선택) νŽ˜μ΄μ§€ μœ„μΉ˜ κΈ°λ³Έκ°’ : 1
pSize INTEGER(선택) νŽ˜μ΄μ§€ λ‹Ή μ‹ μ²­ 숫자 κΈ°λ³Έκ°’ : 100
stats BOOLEAN(선택) API 호좜/응닡 μ‹œκ°„ κΈ°λ³Έκ°’ : false

Usage

import NeisApi from "neis-api.ts";

const neis = new NeisApi({
  key: NEIS_API_KEY,
});

const fetch = async () => {
  try {
    const response = await neis.getSchoolInfo({
      ATPT_OFCDC_SC_CODE: "μ‹œλ„κ΅μœ‘μ²­μ½”λ“œ",
      SD_SCHUL_CODE: "ν–‰μ •ν‘œμ€€μ½”λ“œ",
    });
    console.log("API response:", response);
  } catch (error) {
    console.error("Error:", error);
  }
};

fetch();

NEIS API Docs