语雀AIP 配置和简单使用
1. 设置 TOKEN号
进入个人设置 ,
Terminal 内 输入
curl -H "X-Auth-Token: 你的token " https://www.yuque.com/api/v2/hello
|
import requests url = "https://www.yuque.com/api/v2/repos/646554/docs/" header = {"X-Auth-Token":""}
Result = requests.get(url, headers = header).json()
requests.post(url, headers = header).json()
|
返回:
{"data":{"message":"Hello Karroben"}}
|
2. 获取用户信息:
https://www.yuque.com/yuque/developer/user
官方例子:
GET /users/:login
GET /users/:id
|
说明: GET = curl -H "X-Auth-Token: 你的token " https://www.yuque.com/api/v2
这一串
使用方法:
把https://www.yuque.com/api/v2/hello
的 hello 去掉加上users/, 再加上你的ID
curl -H "X-Auth-Token: 你的token " https://www.yuque.com/api/v2/users/liuwenkan
|
返回:
{"data": {"id":691897, "type":"User", "space_id":0, "account_id":494138, "login":"liuwenkan", "name":"Karroben", "avatar_url":"https://cdn.nlark.com/yuque/0/2019/jpeg/anonymous/1576914522864-5dabd37e-9a90-4ee4-96b4-a1973dbcede4.jpeg", "books_count":8, "public_books_count":8, "followers_count":1, "following_count":2, "public":1, "description":"R 语言作图索引:https://karobben.github.io/R/R-index.html", "created_at":"2019-12-21T07:49:03.000Z","updated_at":"2020-02-14T02:57:36.000Z", "_serializer":"v2.user_detail" } }
|
3. 获取repository信息
https://www.yuque.com/yuque/developer/repo
GET /users/:login/repos
GET /groups/:login/repos
GET /users/:id/repos GET /groups/:id/repos
|
一样, Get = 前面一大串
例子:
curl -H "X-Auth-Token: 你的token " https://www.yuque.com/api/v2/repos/liuwenkan/python
|
返回太多, 不在这里赘述
Post a passage
Example for post a Non-title passage
curl -v -X POST test.md -H "${Your Token}" https://www.yuque.com/api/v2/repos/646554/docs/
|