qiita
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQiita 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_tokenGet 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 and keep the pipe outside. This ensures proper variable substitution:
bash -c '...'bash
undefined当在带有管道符的命令中使用环境变量时,请始终将命令包裹在中,并将管道符放在外面,这样可以确保变量被正确替换:
bash -c '...'bash
undefinedGood - 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
undefinedcurl -H "Authorization: Bearer ${QIITA_TOKEN}" https://api.qiita.com/api/v2/users
undefinedRequired Scopes
所需权限范围
- - Read articles, comments, users
read_qiita - - Post articles, comments
write_qiita
- - 读取文章、评论、用户信息
read_qiita - - 发布文章、评论
write_qiita
How to Use
使用方法
Commands
支持的命令
The script supports 5 modules: , , , ,
itemusertagcommentauth该脚本支持5个模块:、、、、
itemusertagcommentauth1. 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"| Parameter | Required | Default | Description |
|---|---|---|---|
| --query | Yes | - | Search query (supports tag:, user:, title:, body:, stocks:) |
| --page | No | 1 | Page number |
| --per-page | No | 20 | Items 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:语法) |
| --page | 否 | 1 | 页码 |
| --per-page | 否 | 20 | 每页展示数量(最大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 10bash
scripts/qiita.sh item mine --per-page 10Post 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| Parameter | Required | Default | Description |
|---|---|---|---|
| --title | Yes | - | Article title |
| --body | Yes* | - | Article body in Markdown |
| --body-file | Yes* | - | Read body from file (alternative to --body) |
| --tags | Yes | - | Comma-separated tags (max 5) |
| --private | No | false | Create 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个) |
| --private | 否 | false | 创建为私有文章 |
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 mebash
scripts/qiita.sh user meGet 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 10bash
scripts/qiita.sh user items --id "username" --per-page 10Get 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| Parameter | Required | Default | Description |
|---|---|---|---|
| --page | No | 1 | Page number |
| --per-page | No | 20 | Tags per page |
| --sort | No | count | Sort by: count or name |
bash
scripts/qiita.sh tag list --per-page 20
scripts/qiita.sh tag list --sort count| 参数 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| --page | 否 | 1 | 页码 |
| --per-page | 否 | 20 | 每页展示标签数量 |
| --sort | 否 | count | 排序规则: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 10bash
scripts/qiita.sh tag items --id "JavaScript" --per-page 104. 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 verifyReturns current user info if token is valid.
bash
scripts/qiita.sh auth verify如果令牌有效,会返回当前用户的信息。
Search Query Syntax
搜索查询语法
Qiita search supports special operators:
| Operator | Example | Description |
|---|---|---|
| tag: | | Filter by tag |
| user: | | Filter by author |
| title: | | Search in title |
| body: | | Search in body |
| stocks: | | Filter by stock count |
| created: | | Filter by date |
Combine operators:
tag:React title:hooks stocks:>50Qiita搜索支持以下特殊运算符:
| 运算符 | 示例 | 描述 |
|---|---|---|
| tag: | | 按标签筛选 |
| user: | | 按作者筛选 |
| title: | | 在标题中搜索 |
| body: | | 在正文中搜索 |
| stocks: | | 按收藏数筛选 |
| created: | | 按创建日期筛选 |
可组合使用运算符:
tag:React title:hooks stocks:>50Examples
使用示例
Search and Read Articles
搜索和阅读文章
bash
undefinedbash
undefinedSearch 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"
undefinedscripts/qiita.sh item get --id "abc123def456"
undefinedPublish an Article
发布文章
bash
undefinedbash
undefinedPost 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"
undefinedscripts/qiita.sh item post --title "My Technical Article" --body-file ./my-article.md --tags "Programming"
undefinedExplore Tags and Users
探索标签和用户
bash
undefinedbash
undefinedGet 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
undefinedscripts/qiita.sh user items --id "famous_author" --per-page 5
undefinedGuidelines
使用规范
- Rate Limits: 1000 requests/hour (authenticated), 60/hour (unauthenticated)
- Tags: Maximum 5 tags per article
- Markdown: Article body supports GitHub-flavored Markdown
- Private Articles: Use flag for drafts or private content
--private - Search: Use operators for precise search results
- 请求频率限制:认证用户每小时可请求1000次,未认证用户每小时60次
- 标签限制:每篇文章最多添加5个标签
- Markdown支持:文章正文支持GitHub风格的Markdown语法
- 私有文章:使用参数可创建草稿或私有内容
--private - 搜索技巧:使用运算符可获得更精准的搜索结果
API Reference
API参考文档
- Documentation: https://qiita.com/api/v2/docs
- Access Tokens: https://qiita.com/settings/tokens/new