qiita

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Qiita API

Qiita API

Qiita is a technical knowledge sharing platform popular in Japan. This skill provides integration for searching articles, publishing content, and interacting with the community.
Qiita是日本流行的技术知识分享平台。本工具提供了对接该平台的能力,可用于搜索文章、发布内容以及和社区互动。

When to Use

使用场景

  • Search technical articles on Qiita
  • Get articles by tag or user
  • Publish technical articles
  • Read and post comments
  • Get trending tags and topics
  • 在Qiita上搜索技术文章
  • 根据标签或用户获取文章
  • 发布技术文章
  • 阅读和发布评论
  • 获取热门标签和话题

Prerequisites

前置要求

Set the following environment variable:
bash
export QIITA_TOKEN=your_access_token
Get your access token from: https://qiita.com/settings/tokens/new
设置以下环境变量:
bash
export QIITA_TOKEN=your_access_token
你可以从以下地址获取访问令牌:https://qiita.com/settings/tokens/new

Important: Environment Variables and Pipes

重要提示:环境变量与管道符使用说明

When using environment variables in commands with pipes, always wrap the command in
bash -c '...'
and keep the pipe outside. This ensures proper variable substitution:
bash
undefined
当在带有管道符的命令中使用环境变量时,请始终将命令包裹在
bash -c '...'
中,并将管道符放在外面,这样可以确保变量被正确替换:
bash
undefined

Good - wraps curl in bash -c, pipe is outside

Good - wraps curl in bash -c, pipe is outside

bash -c 'curl -H "Authorization: Bearer ${QIITA_TOKEN}" https://api.qiita.com/api/v2/users'
bash -c 'curl -H "Authorization: Bearer ${QIITA_TOKEN}" https://api.qiita.com/api/v2/users'

Bad - environment variable with pipe causes issues

Bad - environment variable with pipe causes issues

curl -H "Authorization: Bearer ${QIITA_TOKEN}" https://api.qiita.com/api/v2/users
undefined
curl -H "Authorization: Bearer ${QIITA_TOKEN}" https://api.qiita.com/api/v2/users
undefined

Required Scopes

所需权限范围

  • read_qiita
    - Read articles, comments, users
  • write_qiita
    - Post articles, comments
  • read_qiita
    - 读取文章、评论、用户信息
  • write_qiita
    - 发布文章、评论

How to Use

使用方法

Commands

支持的命令

The script supports 5 modules:
item
,
user
,
tag
,
comment
,
auth

该脚本支持5个模块:
item
user
tag
comment
auth

1. Item - Articles

1. Item - 文章模块

Search Articles

搜索文章

bash
scripts/qiita.sh item search --query "React hooks"
scripts/qiita.sh item search --query "tag:Python" --per-page 20
scripts/qiita.sh item search --query "user:username title:tutorial"
ParameterRequiredDefaultDescription
--queryYes-Search query (supports tag:, user:, title:, body:, stocks:)
--pageNo1Page number
--per-pageNo20Items per page (max 100)
bash
scripts/qiita.sh item search --query "React hooks"
scripts/qiita.sh item search --query "tag:Python" --per-page 20
scripts/qiita.sh item search --query "user:username title:tutorial"
参数是否必填默认值描述
--query-搜索查询(支持tag:、user:、title:、body:、stocks:语法)
--page1页码
--per-page20每页展示数量(最大100)

Get Article

获取文章

bash
scripts/qiita.sh item get --id "article_id"
bash
scripts/qiita.sh item get --id "article_id"

Get My Articles

获取我的文章

bash
scripts/qiita.sh item mine --per-page 10
bash
scripts/qiita.sh item mine --per-page 10

Post Article

发布文章

bash
scripts/qiita.sh item post --title "Article Title" --body "# Content" --tags "Python,Tutorial"
scripts/qiita.sh item post --title "Draft Post" --body-file ./article.md --tags "React" --private
ParameterRequiredDefaultDescription
--titleYes-Article title
--bodyYes*-Article body in Markdown
--body-fileYes*-Read body from file (alternative to --body)
--tagsYes-Comma-separated tags (max 5)
--privateNofalseCreate as private article
bash
scripts/qiita.sh item post --title "Article Title" --body "# Content" --tags "Python,Tutorial"
scripts/qiita.sh item post --title "Draft Post" --body-file ./article.md --tags "React" --private
参数是否必填默认值描述
--title-文章标题
--body二选一必填-Markdown格式的文章正文
--body-file二选一必填-从文件读取正文(--body参数的替代方案)
--tags-英文逗号分隔的标签(最多5个)
--privatefalse创建为私有文章

Update Article

更新文章

bash
scripts/qiita.sh item update --id "article_id" --title "New Title" --body "Updated content"
bash
scripts/qiita.sh item update --id "article_id" --title "New Title" --body "Updated content"

Delete Article

删除文章

bash
scripts/qiita.sh item delete --id "article_id"

bash
scripts/qiita.sh item delete --id "article_id"

2. User - User Information

2. User - 用户信息模块

Get Current User

获取当前用户

bash
scripts/qiita.sh user me
bash
scripts/qiita.sh user me

Get User Profile

获取用户资料

bash
scripts/qiita.sh user get --id "username"
bash
scripts/qiita.sh user get --id "username"

Get User's Articles

获取用户的文章

bash
scripts/qiita.sh user items --id "username" --per-page 10
bash
scripts/qiita.sh user items --id "username" --per-page 10

Get User's Stocks

获取用户的收藏

bash
scripts/qiita.sh user stocks --id "username"
bash
scripts/qiita.sh user stocks --id "username"

Get User's Followers/Following

获取用户的粉丝/关注列表

bash
scripts/qiita.sh user followers --id "username"
scripts/qiita.sh user following --id "username"

bash
scripts/qiita.sh user followers --id "username"
scripts/qiita.sh user following --id "username"

3. Tag - Tags

3. Tag - 标签模块

List Popular Tags

列出热门标签

bash
scripts/qiita.sh tag list --per-page 20
scripts/qiita.sh tag list --sort count
ParameterRequiredDefaultDescription
--pageNo1Page number
--per-pageNo20Tags per page
--sortNocountSort by: count or name
bash
scripts/qiita.sh tag list --per-page 20
scripts/qiita.sh tag list --sort count
参数是否必填默认值描述
--page1页码
--per-page20每页展示标签数量
--sortcount排序规则:count(数量)或name(名称)

Get Tag Info

获取标签信息

bash
scripts/qiita.sh tag get --id "Python"
bash
scripts/qiita.sh tag get --id "Python"

Get Articles by Tag

获取对应标签下的文章

bash
scripts/qiita.sh tag items --id "JavaScript" --per-page 10

bash
scripts/qiita.sh tag items --id "JavaScript" --per-page 10

4. Comment - Comments

4. Comment - 评论模块

Get Article Comments

获取文章评论

bash
scripts/qiita.sh comment list --item-id "article_id"
bash
scripts/qiita.sh comment list --item-id "article_id"

Post Comment

发布评论

bash
scripts/qiita.sh comment post --item-id "article_id" --body "Great article!"
bash
scripts/qiita.sh comment post --item-id "article_id" --body "Great article!"

Delete Comment

删除评论

bash
scripts/qiita.sh comment delete --id "comment_id"

bash
scripts/qiita.sh comment delete --id "comment_id"

5. Auth - Authentication

5. Auth - 认证模块

Verify Token

验证令牌

bash
scripts/qiita.sh auth verify
Returns current user info if token is valid.

bash
scripts/qiita.sh auth verify
如果令牌有效,会返回当前用户的信息。

Search Query Syntax

搜索查询语法

Qiita search supports special operators:
OperatorExampleDescription
tag:
tag:Python
Filter by tag
user:
user:qiita
Filter by author
title:
title:tutorial
Search in title
body:
body:example
Search in body
stocks:
stocks:>100
Filter by stock count
created:
created:>2024-01-01
Filter by date
Combine operators:
tag:React title:hooks stocks:>50
Qiita搜索支持以下特殊运算符:
运算符示例描述
tag:
tag:Python
按标签筛选
user:
user:qiita
按作者筛选
title:
title:tutorial
在标题中搜索
body:
body:example
在正文中搜索
stocks:
stocks:>100
按收藏数筛选
created:
created:>2024-01-01
按创建日期筛选
可组合使用运算符:
tag:React title:hooks stocks:>50

Examples

使用示例

Search and Read Articles

搜索和阅读文章

bash
undefined
bash
undefined

Search for Python tutorials

Search for Python tutorials

scripts/qiita.sh item search --query "tag:Python title:tutorial" --per-page 5
scripts/qiita.sh item search --query "tag:Python title:tutorial" --per-page 5

Get specific article

Get specific article

scripts/qiita.sh item get --id "abc123def456"
undefined
scripts/qiita.sh item get --id "abc123def456"
undefined

Publish an Article

发布文章

bash
undefined
bash
undefined

Post from command line

Post from command line

scripts/qiita.sh item post --title "Getting Started with Docker" --body "# Introduction
Docker is a containerization platform..." --tags "Docker,DevOps,Tutorial"
scripts/qiita.sh item post --title "Getting Started with Docker" --body "# Introduction
Docker is a containerization platform..." --tags "Docker,DevOps,Tutorial"

Post from file

Post from file

scripts/qiita.sh item post --title "My Technical Article" --body-file ./my-article.md --tags "Programming"
undefined
scripts/qiita.sh item post --title "My Technical Article" --body-file ./my-article.md --tags "Programming"
undefined

Explore Tags and Users

探索标签和用户

bash
undefined
bash
undefined

Get trending tags

Get trending tags

scripts/qiita.sh tag list --per-page 10 --sort count
scripts/qiita.sh tag list --per-page 10 --sort count

Get user's articles

Get user's articles

scripts/qiita.sh user items --id "famous_author" --per-page 5
undefined
scripts/qiita.sh user items --id "famous_author" --per-page 5
undefined

Guidelines

使用规范

  1. Rate Limits: 1000 requests/hour (authenticated), 60/hour (unauthenticated)
  2. Tags: Maximum 5 tags per article
  3. Markdown: Article body supports GitHub-flavored Markdown
  4. Private Articles: Use
    --private
    flag for drafts or private content
  5. Search: Use operators for precise search results
  1. 请求频率限制:认证用户每小时可请求1000次,未认证用户每小时60次
  2. 标签限制:每篇文章最多添加5个标签
  3. Markdown支持:文章正文支持GitHub风格的Markdown语法
  4. 私有文章:使用
    --private
    参数可创建草稿或私有内容
  5. 搜索技巧:使用运算符可获得更精准的搜索结果

API Reference

API参考文档