도서 상세

소장자료

  • URL

    http://api.kcisa.kr/openapi/service/rest/meta16/getNlTot

  • 설명

    국립중앙도서관의 소장자료 정보를 외부 개발자 및 사용자가 이를 활용 할 수 있도록 전달하는 API 서비스입니다. 국립중앙도서관에서 제공하는 소장자료의 제목, 발행년도, 크기, 출판사정보 등 다양한 정보를 제공합니다.

  • 기관명

    국립중앙도서관

    갱신주기

    연간

  • 서비스 분야/주체

    API유형

    REST

  • 등록일

    Jan 14, 2020

    활용도

    2,513

오픈 API

요청인자

요청인자 상세표
변수명 타입 변수설명 필수여부
serviceKey string
서비스키

true
numOfRows string
세션당 요청레코드수

false
pageNo string
페이지수

false

출력 값

출력 값 상세표
No 변수명 출력설명
1 title 자원의 명칭
2 creator 주된 책임을 진 개체
3 collectionDb 소속(통제)DB
4 extent 자원의 크기나 재생시간
5 description 내용 (기존 = description(내용) + ' ' + abstract(자원의 대한 요약))
6 url 지식정보자원위치정보
7 affiliation 소속
8 subDescription 보조 서술
9 spatialCoverage 관련장소 (기존 = spatial(공간) + ' ' + venue(장소))
10 person 사람

메시지 설명

메시지 설명 상세표
0000 정상 처리
F2013 서비스 주소 호출 실패
9999 서비스 점검중(내부 서비스 호출 장애)

활용 명세

샘플 데이터

>샘플 데이터 상세

샘플코드

/* Java Sample */
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.io.BufferedReader;
import java.io.IOException;

public class openApi {
public static void main(String[] args) throws IOException {

StringBuilder urlBuilder = new StringBuilder("http://api.kcisa.kr/openapi/service/rest/meta16/getNlTot"); /*URL*/
urlBuilder.append("?" + URLEncoder.encode("serviceKey","UTF-8") + "=서비스키"); /*서비스키*/
urlBuilder.append("&" + URLEncoder.encode("numOfRows","UTF-8") + "=" + URLEncoder.encode("세션당 요청레코드수", "UTF-8")); /*세션당 요청레코드수*/
urlBuilder.append("&" + URLEncoder.encode("pageNo","UTF-8") + "=" + URLEncoder.encode("페이지수", "UTF-8")); /*페이지수*/

URL url = new URL(urlBuilder.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.setRequestMethod("GET");
conn.setRequestProperty("Content-type", "application/json");
System.out.println("Response code: " + conn.getResponseCode());

BufferedReader rd;
if(conn.getResponseCode() >= 200 && conn.getResponseCode() <= 300) {

rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));

} else {

rd = new BufferedReader(new InputStreamReader(conn.getErrorStream()));

}

StringBuilder sb = new StringBuilder();
String line;
while ((line = rd.readLine()) != null) {

sb.append(line);

}
rd.close();
conn.disconnect();
System.out.println(sb.toString());

}

}
/* Javascript Sample*/
var xhr = new XMLHttpRequest();
var url = 'http://api.kcisa.kr/openapi/service/rest/meta16/getNlTot'; /*URL*/
var queryParams = '?' + encodeURIComponent('serviceKey') + '=' + '서비스키'; /*서비스키*/
queryParams += '&' + encodeURIComponent('numOfRows') + '=' + encodeURIComponent('세션당 요청레코드수'); /*세션당 요청레코드수*/
queryParams += '&' + encodeURIComponent('pageNo') + '=' + encodeURIComponent('페이지수'); /*페이지수*/

xhr.open('GET', url + queryParams);
xhr.onreadystatechange = function () {
if (this.readyState == 4) {

console.log('status: ' + this.status);
console.log('resultCode: ' + $(this.responseText).find('resultCode').text());
console.log('resultMsg: ' + $(this.responseText).find('resultMsg').text());

var item = $(this.responseText).find('item');
$(item).each(function(){

console.log("title" + $(this).find("title").text());
console.log("creator" + $(this).find("creator").text());
console.log("collectionDb" + $(this).find("collectionDb").text());
console.log("extent" + $(this).find("extent").text());
console.log("description" + $(this).find("description").text());
console.log("url" + $(this).find("url").text());
console.log("affiliation" + $(this).find("affiliation").text());
console.log("subDescription" + $(this).find("subDescription").text());
console.log("spatialCoverage" + $(this).find("spatialCoverage").text());
console.log("person" + $(this).find("person").text());

});

};

}
xhr.send('');