# 1. 개요 > 참조 문서 : https://tistory.github.io/document-tistory-apis/ > > 최종 작업일 2020.02.18 ( 참조용 ) * 목표 1 : 스팀잇에 쓰인 글을 주소 입력만으로 TISTORY 로 바로 등록하기 * 목표 2 : 자동으로 TISTORY 에 주기적으로 글 작성하기 # 2. 작업환경 * nodejs + express : 최신버전으로 설치하면 무난 # 3. TISTORY API 키 발급받기 #### 3.1. 등록페이지 접속 : https://www.tistory.com/guide/api/manage/register ![](https://cdn.steemitimages.com/DQmXb15VGojciXRRMGMVRqCCxjFFwRs3L893dcm97r8X3C2/image.png) > 이메일주소와 ID를 입력하여 로그인 #### 3.2. 앱 등록 - 정보 등록 > CallBack 이 중요. 나머지는 적당히 입력해도 상관 없음. ![](https://cdn.steemitimages.com/DQmU89VxSTKcfmdmXcA9DLR2pTS1KUwcCwXGg7Kt3AmmrHj/image.png) #### 3.3. 앱 관리 - 정보확인 > APP ID 와 Secret Key 는 매우 중요한 정보이므로 타인에게 노출되지 않도록 조심하기 바랍니다. ![](https://cdn.steemitimages.com/DQmcmMKC1gYDTPmBdmADMzdrMCjRpgw8qL7J4RYdhXyfFi1/image.png) # 4. NODEJS + EXPRESS > 웹서비스를 구축해서 ACCESS_TOKEN 정보를 받아보도록 하겠습니다. #### 4.1. 설치 정보 * nodejs 설치 : https://nodejs.org 접속 후 download 및 설치(다음 or next 만 잘 누름 됨 ) * express 설치 > 웹 프레임워크는 expressjs, 웹 호출용 request (또는 axios 설치해도 됨 ) , node 모니터링용 nodemon 이렇게 3개를 설치 ``` $ mkdir web $ cd web $ npm init (이후 enter 만 쳐서 일단 기본값으로 완료) $ npm install express request $ npm install -g nodemon ``` #### 4.2. 파일 수정 및 생성 * package.json 수정 > "main" : "app.js" 로 수정 * app.js 파일 생성 > 인증에 필요한 부분만 구현 ```js const express = require('express'); const path = require('path'); const request = require('request'); // init const app = express(); // 라우팅 설정 app.get('/tistory/auth/res', function(req,res,body){ // client_id, redirect_uri 값 입력을 통해 Authentication Code 값을 얻어 온다. // https://www.tistory.com/oauth/authorize?client_id=1fd6a4c18027723413ebedbb0b58c1f2&redirect_uri=http://localhost:3000/tistory/auth/res&response_type=code let client_id = '위에서 생성한 자신의 APP ID 입력'; let client_secret = '위에서 생성한 자신의 Secret Key 입력'; let code = req.query.code; let redirect_uri = 'http://localhost:3000/tistory/auth/res'; // 사용은 안되는데 누락되면 오류 let url = `https://www.tistory.com/oauth/access_token?client_id=${client_id}&client_secret=${client_secret}&code=${code}&redirect_uri=${redirect_uri}&grant_type=authorization_code`; let options = { url, method : 'get', timeout : 1000, }; request(options, function (error, response, body) { if(error){ res.send(error); }else{ res.send(body); } }); }); // start server const SERVER_PORT = 3000; app.listen(SERVER_PORT, function(){ console.log(`server is started with http://localhost:${SERVER_PORT}`); }) ``` #### 4.3. 웹서버 실행 ![](https://cdn.steemitimages.com/DQmY6Hvb9BoLFhnExzCozNWavRpkgejt5eaBGMTsrPtxFaz/image.png) > $ nodemon # 5. ACCESS_TOKEN 확인하기 #### 5.1. 인증 페이지 접속 ![](https://cdn.steemitimages.com/DQmQaoNoj5sWhZvrm6rpU7AKm7ivwrAja1y2MtddT5cR19X/image.png) https://www.tistory.com/oauth/authorize?client_id=MY_CLIENT_ID&redirect_uri=http://localhost:3000/tistory/auth/res&response_type=code > 위 주소 값에서 `client_id`, `redirect_uri` 위 2가지 값을 확인한 후 접속한 다음 확인 버튼을 눌러 ACCESS_TOKEN 값을 확인한다 _결과 예시_ ``` access_token=a39f1d********************************** ``` # 맺음말 일단 ACCESS_TOKEN 을 확보 했다면 뭐 거의 다 완료 했다고 보면 됩니다. 이제 이것을 이용하여 글을 작성하면 됩니다. (다음편에 계속 ... ) https://tistory.github.io/document-tistory-apis/ 링크를 참조하면 API 활용 방법을 볼 수 있습니다.
post_id | 84,493,753 |
---|---|
author | wonsama |
permlink | nodejs-tistory-api-1 |
category | zzan |
json_metadata | {"tags":["zzan","sct","sct-freeboard","sct-kr","steemleo","palnet","liv","mini","busy","dblog"],"image":["https:\/\/cdn.steemitimages.com\/DQmXb15VGojciXRRMGMVRqCCxjFFwRs3L893dcm97r8X3C2\/image.png","https:\/\/cdn.steemitimages.com\/DQmU89VxSTKcfmdmXcA9DLR2pTS1KUwcCwXGg7Kt3AmmrHj\/image.png","https:\/\/cdn.steemitimages.com\/DQmcmMKC1gYDTPmBdmADMzdrMCjRpgw8qL7J4RYdhXyfFi1\/image.png","https:\/\/cdn.steemitimages.com\/DQmY6Hvb9BoLFhnExzCozNWavRpkgejt5eaBGMTsrPtxFaz\/image.png","https:\/\/cdn.steemitimages.com\/DQmQaoNoj5sWhZvrm6rpU7AKm7ivwrAja1y2MtddT5cR19X\/image.png"],"links":["https:\/\/tistory.github.io\/document-tistory-apis\/","https:\/\/www.tistory.com\/guide\/api\/manage\/register","https:\/\/nodejs.org","https:\/\/www.tistory.com\/oauth\/authorize?client_id=MY_CLIENT_ID&redirect_uri=http:\/\/localhost:3000\/tistory\/auth\/res&response_type=code"],"app":"steemcoinpan\/0.1","format":"markdown","canonical_url":"https:\/\/www.steemcoinpan.com\/@wonsama\/nodejs-tistory-api-1"} |
created | 2020-02-18 02:49:54 |
last_update | 2020-02-18 02:49:54 |
depth | 0 |
children | 4 |
net_rshares | 39,350,151,185,649 |
last_payout | 2020-02-25 02:49:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 6.332 SBD |
curator_payout_value | 5.864 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 3,184 |
author_reputation | 959,891,668,598,481 |
root_title | "[개발][자동화][NODEJS] TISTORY API로 글쓰기 - 1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
norbu | 0 | 98,198,847,241 | 50% | ||
alexsandr | 0 | 3,940,895,143 | 5% | ||
petrvl | 0 | 10,685,033,583 | 1.5% | ||
cupang | 0 | 319,415,081 | 90% | ||
ai-channel | 0 | 10,014,440,485 | 27% | ||
belahejna | 0 | 1,788,052,912 | 1.5% | ||
sonki999 | 0 | 307,207,466,144 | 20% | ||
stylegold | 0 | 733,444,061 | 100% | ||
jinuking | 0 | 14,984,464,704 | 100% | ||
fur2002ks | 0 | 236,775,235,472 | 15% | ||
ukk | 0 | 309,642,519,575 | 100% | ||
cyan2017 | 0 | 181,389,878,606 | 100% | ||
y-o-u-t-h-m-e | 0 | 436,362,810,251 | 20% | ||
ioioioioi | 0 | 50,124,296,785 | 30% | ||
nokodemion | 0 | 103,891,433,357 | 100% | ||
sweetpapa | 0 | 958,304,658 | 12.5% | ||
philhyuntd | 0 | 2,001,881,635 | 100% | ||
ayogom | 0 | 15,349,899,514 | 100% | ||
vaansteam | 0 | 149,454,005,200 | 30% | ||
yasu | 0 | 93,506,565,992 | 20% | ||
photoholic | 0 | 756,530,148,138 | 15% | ||
futurecurrency | 0 | 9,944,079,244 | 25% | ||
leeyh | 0 | 1,843,659,362,018 | 100% | ||
songbj | 0 | 3,048,999,457 | 100% | ||
donekim | 0 | 133,335,101,624 | 100% | ||
stmdev | 0 | 83,085,533 | 1% | ||
hodolbak | 0 | 13,745,976,291 | 24% | ||
lucky2015 | 0 | 336,450,620,506 | 100% | ||
angelinafx | 0 | 16,995,384,380 | 5.2% | ||
parkname | 0 | 86,730,380,646 | 25% | ||
jaydih | 0 | 210,538,021,380 | 5% | ||
slowdive14 | 0 | 29,110,857,694 | 100% | ||
andrewma | 0 | 0 | 0.2% | ||
kimseun | 0 | 32,703,240,494 | 5% | ||
kibumh | 0 | 164,625,653,974 | 50% | ||
anpigon | 0 | 149,741,131,833 | 100% | ||
liable | 0 | 1,628,186,790 | 40% | ||
luminaryhmo | 0 | 800,309,167 | 100% | ||
xxnoaxx | 0 | 27,297,095,403 | 100% | ||
freegon | 0 | 176,139,354,303 | 100% | ||
kbaek81 | 0 | 84,965,638,141 | 100% | ||
kanadaramagi123 | 0 | 22,258,773,174 | 5% | ||
suonghuynh | 0 | 827,653,462,490 | 5.2% | ||
loveecho | 0 | 39,362,129,829 | 5% | ||
rokairforce | 0 | 3,423,329,732 | 40% | ||
likuku | 0 | 6,942,103,292 | 100% | ||
angelslake | 0 | 8,442,103,002 | 5% | ||
daath | 0 | 4,329,353,602 | 100% | ||
smartvote | 0 | 545,445,967,001 | 5.2% | ||
china.mobile | 0 | 244,417,124 | 5% | ||
wordit | 0 | 8,178,344,372 | 5% | ||
sj-jeong | 0 | 268,310,869,521 | 5% | ||
kr-coffeesteem | 0 | 3,989,415,318,498 | 100% | ||
wondumyungga | 0 | 18,096,582,624 | 5% | ||
laissez-faire | 0 | 218,251,839 | 100% | ||
aquawink | 0 | 20,632,159,162 | 5% | ||
eunsik.wallet | 0 | 1,793,320,828 | 100% | ||
merlin7 | 0 | 25,652,290,241 | 2.5% | ||
honeybeerbear | 0 | 20,413,557,645 | 100% | ||
ringit | 0 | 13,922,804,585 | 5% | ||
coreabeforekorea | 0 | 163,742,833,738 | 5% | ||
talkative-bk | 0 | 210,783,497,590 | 5% | ||
moneytron | 0 | 103,937,625,880 | 100% | ||
kakakk | 0 | 10,403,579,296 | 100% | ||
noreference | 0 | 559,770,073 | 100% | ||
jjangjjanggirl | 0 | 6,925,470,382 | 100% | ||
cpt-sparrow | 0 | 81,191,859,452 | 100% | ||
skysung | 0 | 569,077,256 | 100% | ||
j-car | 0 | 550,633,142,755 | 32% | ||
minigame | 0 | 7,467,765,860,764 | 20% | ||
whatdidshewear | 0 | 41,621,855,444 | 5% | ||
sjgod4018 | 0 | 34,012,996,419 | 5% | ||
mustard-seed | 0 | 16,420,426,304 | 5% | ||
jcarvoting | 0 | 4,049,784,064 | 80% | ||
ssc-token | 0 | 514,507,533,392 | 100% | ||
wacol413 | 0 | 5,697,816,690 | 33% | ||
sct.biz | 0 | 19,117,996,808 | 100% | ||
cuifen | 0 | 539,978,114 | 100% | ||
jstory | 0 | 2,965,614,586 | 50% | ||
zzan.adv | 0 | 217,048,901 | 25% | ||
sct.awa | 0 | 12,548,507,194 | 100% | ||
mini.sct | 0 | 2,665,209,129 | 40% | ||
naha.zzan | 0 | 217,386,152 | 100% | ||
realmankwon.scot | 0 | 18,654,614,660 | 100% | ||
cn-sct | 0 | 1,925,955,747 | 2% | ||
sct.ups | 0 | 1,719,176,836 | 100% | ||
sct1004 | 0 | 421,795,300 | 20% | ||
freegon.sct | 0 | 14,264,074,276 | 100% | ||
sct.krwp | 0 | 236,281,210,608 | 0.35% | ||
jhzzanglove | 0 | 294,331,623 | 100% | ||
steemzzang | 0 | 1,532,697,761,611 | 4% | ||
sct.curator | 0 | 17,083,730,284 | 22.72% | ||
jaykayw | 0 | 11,318,723,035 | 5% | ||
khalsct | 0 | 642,610,245 | 50% | ||
kopasi.sct | 0 | 15,621,697,426,515 | 100% | ||
roseofmylife | 0 | 218,147,370,962 | 15% | ||
pro.msibi | 0 | 32,731,945 | 15% | ||
themilkymark | 0 | 123,080,961,975 | 3.02% | ||
kryptoformator | 0 | 641,142,569 | 0.75% | ||
dblogvoter | 0 | 75,756,851 | 1.95% | ||
reward.tier1a | 0 | 553,224,642 | 100% | ||
p-translation | 0 | 369,387,059,606 | 15% |
전 제가 쓴 티스토리 블로그 글을 스팀잇에 퍼오는 쪽인데 원사마님께서 올리신 이 방법은 스팀잇에 글 쓰면 자동으로 티스토리에 등록되게 하는 것인가요? 유용해 보입니다
post_id | 84,495,014 |
---|---|
author | slowdive14 |
permlink | q5vp5q |
category | zzan |
json_metadata | {"app":"steemit\/0.1"} |
created | 2020-02-18 03:46:39 |
last_update | 2020-02-18 03:46:39 |
depth | 1 |
children | 1 |
net_rshares | 0 |
last_payout | 2020-02-25 03:46:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 92 |
author_reputation | 17,601,738,132,884 |
root_title | "[개발][자동화][NODEJS] TISTORY API로 글쓰기 - 1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
넵 정방향 역방향 둘 다 가능합죠 . 최종 목표는 온갖 블로그를 한번에 포스팅 하는 것인지라 ㅋ
post_id | 84,499,164 |
---|---|
author | wonsama |
permlink | q5vzgz |
category | zzan |
json_metadata | {"app":"steemit\/0.1"} |
created | 2020-02-18 07:29:24 |
last_update | 2020-02-18 07:29:24 |
depth | 2 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-02-25 07:29:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 54 |
author_reputation | 959,891,668,598,481 |
root_title | "[개발][자동화][NODEJS] TISTORY API로 글쓰기 - 1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
저도 쓸수 있게 해주세요
post_id | 84,496,738 |
---|---|
author | zzings |
permlink | q5vtt2 |
category | zzan |
json_metadata | {"app":"steemit\/0.1"} |
created | 2020-02-18 05:27:03 |
last_update | 2020-02-18 05:27:03 |
depth | 1 |
children | 1 |
net_rshares | 0 |
last_payout | 2020-02-25 05:27:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 13 |
author_reputation | 1,646,897,865,482,869 |
root_title | "[개발][자동화][NODEJS] TISTORY API로 글쓰기 - 1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
다 완성 돠면 촤대한 쉽게 해보죵 ㅎㅎ
post_id | 84,499,172 |
---|---|
author | wonsama |
permlink | q5vzhp |
category | zzan |
json_metadata | {"app":"steemit\/0.1"} |
created | 2020-02-18 07:29:51 |
last_update | 2020-02-18 07:29:51 |
depth | 2 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-02-25 07:29:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 21 |
author_reputation | 959,891,668,598,481 |
root_title | "[개발][자동화][NODEJS] TISTORY API로 글쓰기 - 1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |