[include(TheWiki:공식 문서)] [br] [목차] = 개요 = 더위키에서는 다음과 같은 API를 제공하고 있습니다. 관련된 문의사항은 [[https://thewiki.kr/request/|기술 지원]]을 통해 문의해주시기 바랍니다. API는 '''UTF-8''' 인코딩으로 동작합니다. ASCII 인코딩을 사용하는 텍스트 값을 전달할 경우 API가 정상적으로 동작하지 않습니다. = 기능 = * 문서의 RAW 확인 * 특정 덤프 버전 지정 가능 * 파일: 문법의 이미지 확인 = 예외 오류 = || Message || 설명 || 해결방안 || || main db error || DB 서버 오류 || [[https://thewiki.kr/request/|기술 지원]] 요청 || || sub db error || DB 서버 오류 || [[https://thewiki.kr/request/|기술 지원]] 요청 || || mongoDB server error || DB 서버 오류 || [[https://thewiki.kr/request/|기술 지원]] 요청 || || please check document title || title이 지정되지 않음 || 문서명을 title 값으로 전달하세요. || || forbidden || 권한 없음 || 없음 || || reversion error || 해당 docReVersion 값의 raw 데이터가 없음 || docReVersion 값 수정 || || please check document reversion || 해당 docVersion 값의 덤프 버전이 없음 || docVersion 값 수정 || || empty document || 비어있는 문서 || || || key error || 일치하는 key 없음 || 정확한 key 값 전달 || || key expire || 해당 key가 만료됨 || key 갱신 또는 재발급한 key 값 전달 || || need key || API key 값 비어있음 || API 요청시 key값 전달 || || API error || 정의되지 않은 오류 || [[https://thewiki.kr/request/|기술 지원]] 요청 || = 값 = == docReVersion == * 허용되는 값 : 1 이상의 정수 해당 docReVersion 값의 raw 데이터를 return함 == docVersion == * 허용되는 값 : 160229, 160329, 160425, 160530, 160627, 160728, 160829, 161031, 170327, 180326, 190312, 200302, 210301 해당 docVersion 값의 덤프 버전을 기준으로 raw 데이터를 return함 == title == * 허용되는 값 : 제한 없음 해당 title의 문서 raw를 return함 == namespace == * 허용되는 값 : 0, 1, 2, 3, 4, 6, 8, 10, 11 해당 namespace와 title의 문서 raw를 return함 namespace 값이 전달되지 않을 경우 0 으로 지정됨. 각 값 별로 다음 namespace로 설정됨 || 전달 값 || namespace || || 0 || || || 1 || 틀 || || 2 || 분류 || || 3 || 파일 || || 4 || 사용자 || || 6 || 나무위키 || || 8 || 휴지통 || || 10 || TheWiki || || 11 || 이미지 || == w == * 허용되는 값 : 파일 문서 형식 (파일:ABC.jpg) 또는 이미지 문서 형식 (이미지:ABC.jpg) 해당 파일 문서의 이미지 정보를 return 함 = 사용 방법 = == 최신 버전의 문서 raw를 호출하는 방법 == {{{ $request = array('namespace'=>10, 'title'=>'홈', 'key'=>'API KEY 값'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://thewiki.kr/API.php'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 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, [rev] => doc reversion, [deleted] => boolean === 특정 덤프 버전의 raw를 호출하는 경우 === {{{ $request = array('namespace'=>6, 'title'=>'대문', 'docVersion'=>170327, 'key'=>'API KEY 값'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://thewiki.kr/API.php'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 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] => 덤프 버전의 전체 문서 개수, [rev] => 0 === 특정 리버전의 raw를 호출하는 경우 === {{{ $request = array('namespace'=>10, 'title'=>'홈', 'docReVersion'=>20, 'key'=>'API KEY 값'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://thewiki.kr/API.php'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 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, [deleted] => boolean == 이미지 호출하는 방법 == {{{ $request = array('w'=>'파일:!!!!!.jpg', 'key'=>'API KEY 값'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://thewiki.kr/API.php'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 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 : [status] => success, [link] => 이미지 URL 주소, [animate] => boolean[*A animate 값이 true인 경우 link 값 URL 뒤에 .mp4를 추가해야함 (?????.gif => ?????.gif.mp4)] === 잘못된 파일 형식인 경우 === return : [status] => fail, [name] => 전달된 파일 값 === 처리되지 않은 이미지를 호출하는 경우 === return : [status] => in queue, [name] => 전달된 파일 값 === 처리되었으나 검증이 진행중인 이미지를 호출하는 경우 === return : [status] => processing, [link] => 임시 이미지 URL 주소, [animate] => boolean[*A] [[분류:더위키]]