2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

qiitaから自分のストックを全て削除したいスクリプト

Last updated at Posted at 2017-01-25

はじめに

qiitaのストックがフラット過ぎて管理できなくなったのでevernote管理に移行しました。その結果、qiitaに残っているストック一覧が目障りなので、掃除できたらいいなあと考えました。

スクリプト

rm_stock.sh
#!/bin/sh

# stock urls ( evernote移行用 stock url 回収 )
# curl -X GET "https://qiita.com/api/v2/users/imasami/stocks?per_page=100" | jq ".[].url"

# stock item ids
curl -X GET "https://qiita.com/api/v2/users/imasami/stocks?per_page=100" | jq ".[].id" -r > stocks.txt


# remove all stocks
access_token='<ACCESS_TOKEN>'
for i in `cat stocks.txt`
do
    curl -X DELETE -H "Authorization: Bearer ${access_token}" -H "Cache-Control: no-cache" "https://qiita.com/api/v2/items/${i}/stock"
done
rm stocks.txt

メモ

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?