# API 导入

### 🧙 一些工具

#### 🪄[ ](https://xmnote.gitbook.io/zhi-jian-shu-zhai/shi-yong-zhi-nan/shu-zhai-dao-ru/api-dao-ru/dao-ru-koreader-de-bi-ji)[导入「KOReader」的笔记](#koreader-bi-ji-dao-chu)

#### 🪄[ ](https://xmnote.gitbook.io/zhi-jian-shu-zhai/shi-yong-zhi-nan/shu-zhai-dao-ru/api-dao-ru/dao-ru-koreader-de-bi-ji)[导入「Calibre」的笔记](https://xmnote.gitbook.io/zhi-jian-shu-zhai/shi-yong-zhi-nan/shu-zhai-dao-ru/api-dao-ru/dao-ru-calibre-de-bi-ji)

#### 🪄[导入「阅读记录」的笔记](https://xmnote.gitbook.io/zhi-jian-shu-zhai/shi-yong-zhi-nan/shu-zhai-dao-ru/api-dao-ru/dao-ru-yue-du-ji-lu-de-bi-ji)

{% hint style="success" %}
🌱 如果你开发了好用的工具，请联系我，我会将你的作品发布至此处。
{% endhint %}

### API 使用说明

#### 🔗 笔记导入

```url
http://ip:port/send
```

* RequestMethod: POST
* ContentType: application/json

{% hint style="info" %}
此接口支持跨域，因此您在基于 Web 的技术栈开发工具时无需考虑跨域问题。
{% endhint %}

#### Body内容

```json
{
    "title": "山茶文具店", // 书名：必填
    "cover": "https://img2.doubanio.com/view/subject/l/public/s29707472.jpg", // 书籍封面：选填
    "author":"[日] 小川糸", // 作者：选填
    "translator":"王蕴洁", // 译者：选填
    "publisher": "湖南文艺出版社", // 出版社：选填
    "publishDate": 1519833600, // 出版日期：单位秒，选填
    "isbn": "9787540485337", // ISBN：选填
    "type": 1, // 书籍类型，必填。可取值：0：纸质书；1：电子书
    "locationUnit": 1, // 书籍页码类型，必填。可取值：0：进度；1：位置；2：页码
    "entries": [ // 笔记数组
         {
             "page": 100, // 书籍页码\位置\进度，选填
             "text": "与其苦苦追寻失去的东西，还不如好好珍惜自己眼前拥有的东西。", // 原文摘录，选填
             "note": "如果可以预测人生的一切，那么一定很无聊。", // 想法，选填
             "chapter": "春", // 章节，选填
             "time": 1652544669 // 笔记创建日期时间，选填
         }
    ]
}
```

{% hint style="warning" %}
&#x20;在构造请求数据时请注意以下几点：

1. type 将会决定 locationUnit 的取值。若 type 的值为 0（书籍为纸质书），那么 locationUnit 的值只能取 2 。若 type 为1（书籍为电子书），那么 locationUnit 的值可取：0、1。
2. 时间戳的单位为：秒。
   {% endhint %}

#### 响应结果

| 状态码 | 含义              |
| --- | --------------- |
| 200 | 笔记导入成功          |
| 500 | 笔记导入失败，错误发生在业务层 |
