java 페이스북 공유수 가져오기
이번 스프링 프로젝트를 진행하면서, 페이스북 공유수 가져오기 개발을 진행 하면서 알게된점을 정리한다.
1. 브라우저에서 URL이용하여 공유수 가져오는것이 가능함
ex) 브라우저에서 확인가능
* 현재 최신API기준 : V.2.10(권장)
https://graph.facebook.com/v2.10/
?fields=og_object{engagement}
&access_token=306724366157020|cY4DjImCb_ELrf_CuTILhPh9Wwc
&id=https%3A%2F%2Fwww.ohmycompany.com%2Fproject%2FprjView.php%3Fbbs_code%3Dvon_project%26seq%3D1828
(특정버전이상은 조회시 ACCESS_TOKEN이 필요하다, 토큰 가져오는 방법은 다음장에서 공유)
* V2.5기준( 엑세스토큰이 필요없음, 하지만 쉽게 LIMIT에 걸림 )
https://graph.facebook.com/?v2.5/debug=all
&format=json
&ids=http://naver.com&method=get
&pretty=1&suppress_http_code=1
(url에는 urlencode해서 보내주도록 하자 : https://meyerweb.com/eric/tools/dencoder/)
* 약 50번 호출시 아래와 같은 오류 발생
자세한 LIMIT 관련 API
(https://developers.facebook.com/docs/graph-api/advanced/rate-limiting/?locale=ko_KR)
{ "error": { "message": "(#4) Application request limit reached", "type": "OAuthException", "is_transient": true, "code": 4, "fbtrace_id": "GDOX1lZQr9Y" } }