더위키:openAPI (r2판)

편집일시 :



1. 개요
2. 기능
3. 예외 오류
4. 값
4.1. docReVersion
4.2. docVersion
4.3. title
4.4. namespace
4.5. w
5. 사용 방법
5.1. 최신 버전의 문서 raw를 호출하는 방법
5.1.1. 이동된 문서의 raw를 호출하는 경우
5.1.2. 특정 덤프 버전의 raw를 호출하는 경우
5.1.3. 특정 리버전의 raw를 호출하는 경우
5.2. 이미지 호출하는 방법
5.2.1. 처리되지 않은 이미지를 호출하는 경우


1. 개요[편집]


The Wiki에서는 다음과 같은 API를 제공하고 있습니다. 관련된 문의사항은 기술 지원을 통해 문의해주시기 바랍니다.

2. 기능[편집]


  • 문서의 RAW 확인
    • 특정 덤프 버전 지정 가능
    • 특정 IP의 덤프 버전 지정 기능(해당 IP의 개인 설정으로 설정된 덤프 버전) (예정)
  • 파일: 문법의 이미지 확인

3. 예외 오류[편집]


Message
설명
해결방안
main db error
DB 서버 오류
기술 지원 요청
sub db error
DB 서버 오류
기술 지원 요청
mongoDB server error
DB 서버 오류
기술 지원 요청
please check document title
title이 지정되지 않음
문서명을 title 값으로 전달하세요.
forbidden
권한 없음
없음
reversion error
해당 docReVersion 값의 raw 데이터가 없음
docReVersion 값 수정
please check document reversion
해당 docVersion 값의 덤프 버전이 없음
docVersion 값 수정
empty document
비어있는 문서

API error
정의되지 않은 오류
기술 지원 요청

4. 값[편집]



4.1. docReVersion[편집]


  • 허용되는 값 : 1 이상의 정수
해당 docReVersion 값의 raw 데이터를 return함

4.2. docVersion[편집]


  • 허용되는 값 : 160229, 160329, 160425, 160530, 160627, 160728, 160829, 161031, 170327, 180326, 180925
해당 docVersion 값의 덤프 버전을 기준으로 raw 데이터를 return함

4.3. title[편집]


  • 허용되는 값 : 제한 없음
해당 title의 문서 raw를 return함

4.4. namespace[편집]


  • 허용되는 값 : 0, 1, 2, 3, 4, 6, 8, 10, 11
해당 namespace와 title의 문서 raw를 return함
namespace 값이 전달되지 않을 경우 0 으로 지정됨.
각 값 별로 다음 namespace로 설정됨 (괄호안의 namespace는 덤프 버전이 180925일 경우에 해당)
전달 값
namespace
0

1

2
분류
3
파일
4
사용자
6
나무위키 (알파위키)
8
휴지통
10
TheWiki
11
이미지 (집단창작)

4.5. w[편집]


  • 허용되는 값 : 파일 문서 형식 (파일:ABC.jpg)
해당 파일 문서의 이미지를 return 함

5. 사용 방법[편집]



5.1. 최신 버전의 문서 raw를 호출하는 방법[편집]


$request = array('namespace'=>10, 'title'=>'홈');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://thewiki.ga/API.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= json_decode(curl_exec($ch));
curl_close($ch);


return : [status] => success, [type] => raw, [data] => RAW DATA

5.1.1. 이동된 문서의 raw를 호출하는 경우[편집]


return : [status] => success, [type] => refresh, [link] => /w/TheWiki:홈, [namespace] => 10, [title] => 홈

5.1.2. 특정 덤프 버전의 raw를 호출하는 경우[편집]


$request = array('namespace'=>6, 'title'=>'대문', 'docVersion'=>170327);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://thewiki.ga/API.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= json_decode(curl_exec($ch));
curl_close($ch);


return : [status] => success, [type] => raw, [data] => RAW DATA, [contribution] => 기여자 목록, [count] => 덤프 버전의 전체 문서 개수

5.1.3. 특정 리버전의 raw를 호출하는 경우[편집]


$request = array('namespace'=>10, 'title'=>'홈', 'docReVersion'=>20);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://thewiki.ga/API.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= json_decode(curl_exec($ch));
curl_close($ch);


return : [status] => success, [type] => raw, [data] => RAW DATA

5.2. 이미지 호출하는 방법[편집]


$request = array('w'=>'파일:!.jpg');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://thewiki.ga/API.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result= curl_exec($ch);
curl_close($ch);


return :
<img src="https://lh3.googleusercontent.com/-9Um1sLORP3U/Wn8E6VpAXzI/AAAAAAAAxfA/i4v_vBZUNBUybrvb4DN2DA8lrzlrAlHjwCHMYCw/s0/f4628c912dd60b501fac1bea264cd1136368dc81.jpg" style='cursor:hand;'>


5.2.1. 처리되지 않은 이미지를 호출하는 경우[편집]


return : [ No.XXX ] 이미지 등록됨