8
8

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 API v2 活用) Qiita の記事を API 経由で取得する方法

Last updated at Posted at 2018-02-02

やりたいこと

Qiita に投稿された記事を確認したい。

最新の記事を取得するサンプルコード

curl --silent \
  "https://qiita.com/api/v2/items?page=1&per_page=20" \
  | jq .

ユーザーを指定して記事を取得するサンプルコード

curl --silent \
  "https://qiita.com/api/v2/items?page=1&per_page=20&qiita+user:kojiro-s" \
  | jq .

(要トークン) 自分の投稿した記事を取得するサンプルコード

curl --silent \
  --header "Authorization: Bearer ${QIITA_TOKEN}" \
  "https://qiita.com/api/v2/authenticated_user/items?page=1&per_page=20"

自分の投稿した記事タイトルといいねの数を抽出するサンプルコード

curl --silent \
  --header "Authorization: Bearer ${QIITA_TOKEN}" \
  "https://qiita.com/api/v2/authenticated_user/items?page=1&per_page=20" \
  | jq -c '.[] | [.likes_count, .title]'

参考情報

8
8
0

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
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?