실제 데이터로 테스트하기 위해 공개적으로 액세스 할 수있는 JSON 데이터 소스가 있습니까? [닫은]
JavaScript 동적으로로드 된 트리보기 사용자 정의 작업을하고 있습니다. 실제 데이터로 테스트하고 싶습니다.
아무도 JSON 형식의 계층 적 데이터에 대한 액세스를 제공하는 API가있는 공용 서비스를 알고 있습니까?
Twitter에는 JSON을 반환 하는 공용 API 가 있습니다. 예를 들면 다음과 같습니다.
의 GET
요청에 :
https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=mralexgray&count=1
,
편집 : 트위터가 OAUTH
요구 사항으로 API를 제한하여 제거되었습니다 ...
{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]}
Github API 의 간단한 예제로 대체합니다 .이 경우 트리를 반환합니다.이 경우에는 내 저장소 ...
길이가 길기 때문에 출력을 포함하지 않겠습니다. (한 번에 30 개의 repos를 반환합니다.) ... 그러나 여기에 그것이 tree-ed-ness라는 증거가 있습니다.
JSON 테스트에는
무료로 시도하고 다른 기능도 있습니다.
Tumblr에는 JSON을 제공 하는 공용 API 가 있습니다. 와 같은 간단한 URL을 사용하여 게시물 덤프를 얻을 수 있습니다 http://puppygifs.tumblr.com/api/read/json
.
Flickr에서 등록 / API가 필요하지 않은 것을 찾았습니다.
기본 샘플, Fiddle : http://jsfiddle.net/Braulio/vDr36/
더 많은 정보 : 포스트
붙여 넣은 샘플
HTML
<div id="images">
</div>
자바 스크립트
// Querystring, "tags" search term, comma delimited
var query = "http://www.flickr.com/services/feeds/photos_public.gne?tags=soccer&format=json&jsoncallback=?";
// This function is called once the call is satisfied
// http://stackoverflow.com/questions/13854250/understanding-cross-domain-xhr-and-xml-data
var mycallback = function (data) {
// Start putting together the HTML string
var htmlString = "";
// Now start cycling through our array of Flickr photo details
$.each(data.items, function(i,item){
// I only want the ickle square thumbnails
var sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");
// Here's where we piece together the HTML
htmlString += '<li><a href="' + item.link + '" target="_blank">';
htmlString += '<img title="' + item.title + '" src="' + sourceSquare;
htmlString += '" alt="'; htmlString += item.title + '" />';
htmlString += '</a></li>';
});
// Pop our HTML in the #images DIV
$('#images').html(htmlString);
};
// Ajax call to retrieve data
$.getJSON(query, mycallback);
또 다른 흥미로운 점은 Star Wars Rest API입니다.
텀블러 V2 API는 순수한 JSON 응답을 제공하지만 몇 가지 농구를 통해 점프가 필요합니다
- 신청서 등록
- 앱 페이지 에서 애플리케이션을 편집 할 때 찾을 수있는 "OAuth 소비자 키"를 가져 옵니다.
- 의 사용 방법 이 URL에 예를 들어 전달 될 수있는 유일한 인증에 대한 API 키를 요구하는 게시물을
- JSON 응답을 즐기십시오!
URL 예 : http://api.tumblr.com/v2/blog/puppygifs.tumblr.com/posts/photo?api_key=YOUR_KEY_HERE
Fiddler의 트리 구조를 보여주는 결과 :
'program tip' 카테고리의 다른 글
Go 오류 처리 기술 (0) | 2020.08.10 |
---|---|
Python 프로그램에서 EXE 파일을 어떻게 만들 수 있습니까? (0) | 2020.08.10 |
키 입력 A, Ctrl + A, Ctrl + C 및 Ctrl + V를 사용하는 최대 문자 수 (0) | 2020.08.10 |
파이썬에서 언제 메서드 대신 함수를 사용해야합니까? (0) | 2020.08.10 |
Python subprocess.Popen“OSError : [Errno 12] 메모리를 할당 할 수 없습니다.” (0) | 2020.08.10 |