社区 API 接口文档

  • Tiny熊
  • 更新于 2024-04-12 14:30
  • 阅读 938

社区开发 API 接口说明文档

为了方便程序员们发布内容,我们开发了一些 API, 这篇文章是社区 API 接口的说明。 我们还提供了测试服务器,以便在正式服务器上发布内容之前进行测试。

申请Api Key

在使用 API 接口前,需要先申请 Api Key。

如何申请Api Key

接口详情

API 接口地址:

文章发布接口

接口

/post/article

请求方式:POST

请求Header参数

参数名 参数值 参数类型 是否必填 参数描述
Content-Type application/x-www-form-urlencoded String -
x-api-key - String Api Key

请求Body参数

参数名 参数类型 是否必填 参数描述
title String 文章标题
content String 文章正文(采用Markdown格式)
summary String 文章摘要
price String 阅读全文需要使用的学分数,默认为免费阅读
logo String 文章封面图片链接地址
type Integer 文章类型,填写内容 1: 原创, 2: 翻译, 3: 转载,可不填
link String 转载链接,类型为转载时可填写
is_public Integer 文章是否公开,填写内容 1: 公开, 2: 仅自己可见,不填默认为公开
category_id Integer 填写文章分类ID,填写内容为以下分类ID,5: 以太坊, 7: Solidity, 8: 入门, 13: 安全, 23: 零知识, 27: DeFi,可不填

请求示例代码

curl --request POST \
  --url https://learnblockchain.cn/api/post/article \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --header 'x-api-key: ' \
  --data 'title=每周以太坊进展' \
  --data 'content=正文内容...' \
  --data 'summary=摘要内容...' \
  --data 'price=10' \
  --data 'logo= https://img.zcool.cn/community/01c94c563736d66ac7259e0fd89fcb.jpg@2o.jpg' \
  --data 'type= 3' \
  --data link=https://learnblockchain.cn/article/5722 \
  --data 'is_public=1' \
  --data 'category_id=7'

成功响应示例

{
    "code": 0,
    "message": "文章发布成功!"
}

错误响应示例

{
    "code": -1006,
    "message": "文章发布失败, 请稍后再试...!"
}

文章发布成功后可在文章页面(正式服测试服)查看

招聘发布接口

接口

/post/recruit

请求方式: POST

请求Header参数

参数名 示例值 参数类型 是否必填 参数描述
Content-Type application/x-www-form-urlencoded String -
x-api-key - String Api Key

请求Body参数

参数名 参数类型 是否必填 参数描述
name String 招聘名称
content String 招聘描述(采用Markdown格式)
types String 招聘工作类型,示例填写内容 "全职"、"兼职"、"远程"、"实习",不填默认为 "不限"
work_year String 工作经验要求,示例填写内容 "1\~3年"、"3\~5年"、"5年以上",不填默认为 "不限"
education String 学历要求,示例填写内容 "大专"、"本科"、"硕士"、"博士",不填默认为 "不限"
salary String 薪资范围,示例填写内容 "5\~10k"、"10\~20K"、"20\~50k"、"50K以上",不填默认为 "面议"
address String 工作地点
project_description String 项目介绍

请求示例代码

curl --request POST \
  --url https://learnblockchain.cn/api/post/recruit \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'x-api-key: ' \
  --data 'name=合约开发工程师' \
  --data 'content=主要负责项目合约开发...' \
  --data 'types=全职' \
  --data 'work_year=1~3年' \
  --data 'education=本科' \
  --data 'salary=10~20K' \
  --data 'address=上海市浦东新区'\
  --data 'project_description=xx公司, xx团队, 联系电话...'

成功响应示例

{
    "code": 0,
    "message": "招聘信息发布成功!"
}

错误响应示例

{
    "code": -1005,
    "message": "招聘信息发布失败, 请稍后再试...!"
}

招聘发布成功后可在招聘页面(正式服测试服)查看

  • 原创
  • 学分: 3
  • 分类: 站务
  • 标签:
点赞 1
收藏 1
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
Tiny熊
Tiny熊
0xD682...E8AB
登链社区发起人 通过区块链技术让世界变得更好而尽一份力。