扇贝API


1. 用户信息
2. 查询单词
3. 添加单词学习记录
4. 忘记单词
5. 例句
      5.1 获取例句
      5.2 创建例句
      5.3 收藏例句
      5.4 删除例句
6. 笔记
      6.1 获取笔记
      6.2 创建笔记
      6.3 收藏笔记
      6.4 删除笔记


API:获取用户信息

URL: https://api.shanbay.com/account/

请求方式: GET

参数
该请求无需任何参数

返回示例

{
    "username": "username", 
    "nickname": "nickname", 
    "id": 269875, 
    "avatar": "http://qstatic.shanbay.com/thumbnail/media_store/8cb0e9275e8b765ad96817d38e6a0633.jpg"
}

返回字段说明:

username         string         用户登录名
nickanme         string         用户昵称
id               int            用户id
avatar           string         用户头像

API:查询单词

URL: https://api.shanbay.com/bdc/search/?word={word}

请求方式: GET

参数: {word}, 必须,要查询的单词

返回示例

{
    "status_code": 0,
    "msg": "SUCCESS",
    "data": { 
        "en_definitions": {
            n: [
                "an expression of greeting"
            ]
        },
        "cn_definition": {
            "pos": "",
            "defn": "int.(见面打招呼或打电话用语)喂,哈罗"
        },
        "id": 3130,
        "retention": 4,
        "definition": " int.(见面打招呼或打电话用语)喂,哈罗",
        "target_retention": 5,
        "en_definition": {
          "pos": "n",
          "defn": "an expression of greeting"
        },
        "learning_id": 2915819690,
        "content": "hello",
        "pronunciation": "hә'lәu",
        "audio": "http://media.shanbay.com/audio/us/hello.mp3",
        "uk_audio": "http://media.shanbay.com/audio/uk/hello.mp3",
        "us_audio": "http://media.shanbay.com/audio/us/hello.mp3"
    },
}

返回字段说明:

en_definitions   array     返回英文释义的数组
en_definition    object    英文释义
cn_definition    object    中文释义
id               int       单词的id
retention        int       单词的熟悉度
definition       string    中文释义
target_retention int       用户自定义的目标学习度
learning_id      long      learing id,如果未返回,在表明用户没学过该单词
content          string    查询的单词
pronunciation    string    单词的音标

API:添加单词

URL: https://api.shanbay.com/bdc/learning/

请求方式: POST

参数: {id} ,必须,待添加的单词id

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {
        "id": 100019553
    }
}

返回字段说明:

id    long    learning id

API:忘记单词

URL: https://api.shanbay.com/bdc/learning/{learning_id}/

请求方式: PUT

参数: {'forget': 1} ,必须

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {
        "id": 100019553,
        "retention": 0
    }
}

API:获取单词的例句

URL: https://api.shanbay.com/bdc/example/?vocabulary_id={id}&type={type}

请求方式: GET

参数: {id} ,必须,单词id ; {type} 可选, 如果指定type=sys,则返回系统例句

返回示例

{
    "msg": "SUCCESS",
    "status_code": 0,
    "data": [
        {
            id: 443808,
            "user": {
                "username": "username",
                "nickname": "nickanme",
                "id": 72196,
                "avatar": "http://qstatic.shanbay.com/team/media_store/d99aa28621d300c251c67d4c2ede08e8_1.jpg"
            },
            "unlikes": 0,
            "likes": 3,
            "translation": "跟大家打个招呼",
            "annotation": "say <vocab>hello</vocab> to everybody",
            "version": 0,
        },
         {
            id: 443808,
            "user": {
                "username": "username",
                "nickname": "nickanme",
                "id": 72198,
                "avatar": "http://qstatic.shanbay.com/team/media_store/d99aa28621d300c251c67d4c2ede08e8_1.jpg"
            },
            "unlikes": 0,
            "likes": 3,
            "translation": "跟大家打个招呼",
            "annotation": "say <vocab>hello</vocab> to everybody",
            "version": 1
        }
    }
}

返回字段说明:

id           int           例句的id
user         object        用户的json对象
likes        int           喜欢该例句的用户数量
unlikes      int           不喜欢该例句的用户数量
translation  int           例句的翻译
annotation   string        例句原文,vocab括起来的内容是匹配的单词,用来高亮

API:创建例句

URL: https://api.shanbay.com/bdc/example/

请求方式: POST

参数
{vocabulary} ,必须,单词的id
{original} , 必须,例句原文
{translation} ,必须,例句的中文译文
注意:例句和译文的总长度不能超过255个字符,否则添加会失败。

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {
         "unlikes": 0, 
         "likes": 0, 
         "translation": "\u5979\u7684\u732b", 
         "annotation": "<vocab>her</vocab> cat", 
         "user": {
             "username": "shellfly", 
             "nickname": "123456789012345678", 
             "id": 269875, 
             "avatar":"http://qstatic.shanbay.com/thumbnail/media_store/8cb0e9275e8b765ad96817d38e6a0633.jpg"
         },
         "id": 604394, 
         "version": 0, 
    }
}

返回字段说明:

获取例句API


API:收藏例句

URL: https://api.shanbay.com/bdc/learning_example/

请求方式: POST

参数
{example_id} ,必须,例句的id

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {}
}

返回字段说明:

获取例句API


API:删除例句

URL: https://api.shanbay.com/bdc/example/{example_id}/

请求方式: DELETE

参数

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {}
}

返回字段说明:

获取例句API


API:获取笔记

URL: https://api.shanbay.com/bdc/note/?vocabulary_id={id}

请求方式: GET

参数
{id} ,必须,要获取笔记的单词id

返回示例

{
    "msg":"SUCCESS",
    "status_code": 0,
    "data": [
       {
           "content": "并不总是打招呼的意思,有时是“有没有搞错”的意思,要根据上下文来判断。 例子:Hello, anybody home, we’ll be late!( 有没有搞错, 我们要迟到了)",
           "unlikes": 0,
           "likes": 22,
           "id": 94572,
           "user":{
                "username":"username",
                "nickname": "nickname",
                "id": 815741,
                "avatar":"http://qstatic.shanbay.com/thumbnail/media_store/8cb0e9275e8b765ad96817d38e6a0633.jpg"
           }
      },
      {
         "content": "并不总是打招呼的意思,有时是“有没有搞错”的意思,要根据上下文来判断。 例子:Hello, anybody home, we’ll be late!( 有没有搞错, 我们要迟到了)",
         "unlikes": 0,
         "likes": 22,
         "id": 94572,
         "user":{
                "username":"username",
                "nickname": "nickname",
                "id": 815741,
                "avatar":"http://qstatic.shanbay.com/thumbnail/media_store/8cb0e9275e8b765ad96817d38e6a0633.jpg"
           }
      }
   ]
}

返回字段说明:

content        string         笔记内容
likes          int            喜欢该笔记的用户数量
unlikes        int            不喜欢该笔记的用户数量
user           object         用户的json对象

API:创建笔记

URL: https://api.shanbay.com/bdc/note/

请求方式: POST

参数
{vocabulary} ,必须,要创建笔记的单词id
{note}, 必须, 笔记内容

返回示例

{
    "msg":"SUCCESS",
    "status_code": 0,
    "data": {
           "content": "并不总是打招呼的意思,有时是“有没有搞错”的意思,要根据上下文来判断。 例子:Hello, anybody home, we’ll be late!( 有没有搞错, 我们要迟到了)",
           "unlikes": 0,
           "likes": 22,
           "id": 94572,
           "user":{
                "username":"username",
                "nickname": "nickname",
                "id": 815741,
                "avatar":"http://qstatic.shanbay.com/thumbnail/media_store/8cb0e9275e8b765ad96817d38e6a0633.jpg"
           }
      }
  }

返回字段说明:

content        string         笔记内容
likes          int            喜欢该笔记的用户数量
unlikes        int            不喜欢该笔记的用户数量
user           object         用户的json对象

API: 收藏笔记

URL: https://api.shanbay.com/bdc/learning_note/

请求方式: POST

参数
{note_id} ,必须,笔记id

返回示例

{
    "msg":"SUCCESS",
    "status_code": 0,
    "data": {}
}

API: 删除笔记

URL: https://api.shanbay.com/bdc/note/{note_id}/

请求方式: DELETE

参数

返回示例

{
    "msg": "SUCCESS", 
    "status_code": 0, 
    "data": {}
}