panews-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAuthenticated creator workflow via . All endpoints require a header.
https://universal-api.panewslab.comPA-User-Session通过实现已认证的创作者工作流。所有端点都需要请求头。
https://universal-api.panewslab.comPA-User-SessionWhen to Use
适用场景
- The task needs an authenticated creator session
- The user wants to check creator eligibility, manage a column application, upload images, or create/update/delete an article
- The task changes PANews state
- 任务需要已认证的创作者会话
- 用户需要检查创作者资格、管理专栏申请、上传图片,或创建/更新/删除文章
- 任务会改变PANews的状态
Do Not Use When
不适用场景
- The task is public read-only article or ranking lookup
- The user wants a rendered PANews webpage instead of creator API actions
- There is no valid and the request cannot proceed without one
PA-User-Session
- 任务为公开只读的文章或排行榜查询
- 用户需要的是渲染后的PANews网页而非创作者API操作
- 没有有效的,且请求无法在无会话的情况下进行
PA-User-Session
Language
语言设置
| Language | Value |
|---|---|
| Simplified Chinese | |
| Traditional Chinese | |
| English | |
| Japanese | |
| Korean | |
| 语言 | 取值 |
|---|---|
| 简体中文 | |
| 繁体中文 | |
| 英文 | |
| 日语 | |
| 韩语 | |
Standard Workflow
标准工作流
- Validate session →
get-current-user - Get full context →
get-creator-context - No approved column → run column application flow ()
apply-column - Has approved column → search tags () → convert Markdown to HTML → execute article operations
GET /tags
Markdown to HTML command examples:
bash
npx --yes md4x draft.md -t html -o draft.html
bunx md4x draft.md -t html -o draft.htmlUse whichever package runner exists in the current environment.
Copy this checklist and work through it:
text
PANews Creator Progress:
- [ ] Step 1: Validate the session
- [ ] Step 2: Inspect creator context and approved columns
- [ ] Step 3: If needed, complete or resubmit the column application
- [ ] Step 4: Upload assets and gather tag IDs
- [ ] Step 5: Convert Markdown to HTML with the available package runner
- [ ] Step 6: Create or update the article
- [ ] Step 7: Verify the API response before finishing- 验证会话 →
get-current-user - 获取完整上下文 →
get-creator-context - 无已通过的专栏 → 执行专栏申请流程()
apply-column - 有已通过的专栏 → 搜索标签()→ 将Markdown转换为HTML → 执行文章操作
GET /tags
Markdown转HTML命令示例:
bash
npx --yes md4x draft.md -t html -o draft.html
bunx md4x draft.md -t html -o draft.html使用当前环境中存在的任意包运行器即可。
复制以下检查清单并逐步执行:
text
PANews Creator进度:
- [ ] 步骤1:验证会话
- [ ] 步骤2:查看创作者上下文及已通过的专栏
- [ ] 步骤3:如有需要,完成或重新提交专栏申请
- [ ] 步骤4:上传资源并收集标签ID
- [ ] 步骤5:使用可用的包运行器将Markdown转换为HTML
- [ ] 步骤6:创建或更新文章
- [ ] 步骤7:完成前验证API响应Session
会话管理
Resolve from environment in order: → → . On , discard and re-resolve.
PA-User-SessionPANEWS_USER_SESSIONPA_USER_SESSIONPA_USER_SESSION_ID401按以下优先级从环境变量中获取: → → 。若返回,则丢弃现有会话并重新获取。
PA-User-SessionPANEWS_USER_SESSIONPA_USER_SESSIONPA_USER_SESSION_ID401Rules
规则
- Validate the session before any mutating action
- Never hand-write raw HTML article bodies; convert Markdown with a tool such as first
md4x - Treat as a hard stop: discard the session and re-resolve it
401 - Only submit to when the user is ready to send the article for review; otherwise default to
PENDINGDRAFT
- 在执行任何变更操作前先验证会话
- 切勿手动编写原始HTML文章内容;需先使用等工具转换Markdown
md4x - 将错误视为硬停止:丢弃现有会话并重新获取
401 - 仅当用户准备好提交文章审核时,才将状态设为;否则默认使用
PENDINGDRAFT
Scripts
脚本示例
bash
node {Skills Directory}/panews-creator/scripts/get-current-user.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/get-creator-context.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/upload-image.mjs <file-path> [--watermark] [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --name <name> --desc <desc> --picture <url> --links <url,...> [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --column-id <id> [--name] [--desc] [--picture] [--links] [--session <value>]
node {Skills Directory}/panews-creator/scripts/search-tags.mjs <keyword> [--take 20] [--skip 0] [--lang zh]
node {Skills Directory}/panews-creator/scripts/list-articles.mjs --column-id <id> [--status DRAFT|PENDING|PUBLISHED|REJECTED] [--take 20] [--skip 0] [--session <value>]
node {Skills Directory}/panews-creator/scripts/create-article.mjs --column-id <id> --lang <lang> --title <title> --desc <desc> --content-file <path> [--status DRAFT|PENDING] [--cover <url>] [--tags <id,...>] [--session <value>]
node {Skills Directory}/panews-creator/scripts/update-article.mjs --column-id <id> --article-id <id> [fields...] [--session <value>]
node {Skills Directory}/panews-creator/scripts/delete-article.mjs --column-id <id> --article-id <id> [--session <value>]bash
node {Skills Directory}/panews-creator/scripts/get-current-user.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/get-creator-context.mjs [--session <value>]
node {Skills Directory}/panews-creator/scripts/upload-image.mjs <file-path> [--watermark] [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --name <name> --desc <desc> --picture <url> --links <url,...> [--session <value>]
node {Skills Directory}/panews-creator/scripts/apply-column.mjs --column-id <id> [--name] [--desc] [--picture] [--links] [--session <value>]
node {Skills Directory}/panews-creator/scripts/search-tags.mjs <keyword> [--take 20] [--skip 0] [--lang zh]
node {Skills Directory}/panews-creator/scripts/list-articles.mjs --column-id <id> [--status DRAFT|PENDING|PUBLISHED|REJECTED] [--take 20] [--skip 0] [--session <value>]
node {Skills Directory}/panews-creator/scripts/create-article.mjs --column-id <id> --lang <lang> --title <title> --desc <desc> --content-file <path> [--status DRAFT|PENDING] [--cover <url>] [--tags <id,...>] [--session <value>]
node {Skills Directory}/panews-creator/scripts/update-article.mjs --column-id <id> --article-id <id> [fields...] [--session <value>]
node {Skills Directory}/panews-creator/scripts/delete-article.mjs --column-id <id> --article-id <id> [--session <value>]Failure Handling
故障处理
- If session validation fails with , stop and obtain a fresh session before retrying
401 - If there is no approved column, do not attempt article creation; complete the application flow first
- If content formatting looks wrong, re-render the Markdown and inspect the generated HTML before submitting
- If an article update or delete fails because the status is immutable, fetch the current article list and report the blocking state clearly
- 若会话验证返回失败,需停止操作并获取新会话后再重试
401 - 若无已通过的专栏,请勿尝试创建文章;需先完成专栏申请流程
- 若内容格式显示异常,需重新渲染Markdown并检查生成的HTML后再提交
- 若因状态不可变导致文章更新或删除失败,请获取当前文章列表并清晰报告阻塞状态
References
参考文档
| Topic | Description | Reference |
|---|---|---|
| Session | Resolve, validate, and handle session errors | session |
| Column Applications | Submit or resubmit a column application | columns |
| Tags | Search tags by keyword to get IDs for article tagging | tags |
| Articles | List, create, update, delete column articles | articles |
| Content Format | Write in Markdown, convert it to HTML, pass it via --content-file | content-format |
| Upload | Upload images to PANews CDN | upload |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 会话 | 会话的解析、验证及错误处理 | session |
| 专栏申请 | 提交或重新提交专栏申请 | columns |
| 标签 | 通过关键词搜索标签以获取文章标记所需的ID | tags |
| 文章 | 列出、创建、更新、删除专栏文章 | articles |
| 内容格式 | 使用Markdown编写,转换为HTML后通过--content-file参数传递 | content-format |
| 上传 | 将图片上传至PANews CDN | upload |