笔记 API
更新于 27.10.2026
有两种类型的笔记在VISH: 课堂笔记 教师或职员离开整个小组,以及 个人笔记 这个人只为自己写作。 它们通过API以不同的方式提供。 2026年10月23日与摊位d1核对;本页的方法也可在生产中使用。
课程注意事项
小组材料:作业,链接,文件。 任何看到课程的人都可以阅读它们—没有钥匙。
| 方法 | 做什么? | 谁能 |
|---|---|---|
GET /schedule/{id}/notes | 一课笔记 | 全部 |
POST /schedule/{id}/notes | 添加注释 | 对schedule:note:create |
POST /schedule/{id}/notes/attachments | 为笔记上传文件(最多10MB,一次一个) | 对schedule:note:create |
PATCH /schedule/notes/{noteId} | 编辑注释 | 对schedule:note:update |
DELETE /schedule/notes/{noteId} | 删除注释 | 对schedule:note:delete |
注: id, lessonId, content(书面标记), contentL10n (翻译), attachments, author, createdAt, updatedAt. 您可以在schedule本身—字段中看到班级有多少笔记notesCount.
你可以用钥匙写笔记:老师的钥匙有标记的权利schedule:note:*自己担任老师。 该文件首先作为单独的请求上传,并且返回的下载内容被发送到笔记。 图像保存在WebP中;PDF、office文档和文本保存为下载文件;其他不接受(415)。
这样的请求发布了一个真实的注释,整个小组都会看到。 在d1的小组班里试试。:
curl -X POST "$VISH_API/schedule/$LESSON_ID/notes" \
-H "X-Api-Key: $VISH_API_KEY" -H "Content-Type: application/json" \
-d '{"content": "Homework: exercises 1–5, page 42"}'该“登录令牌后VISH”与决议notes:read只读GET /schedule/{id}/notes.
个人笔记
只有其作者看到的注释。: GET, POST /personal-notes, GET, PATCH, DELETE /personal-notes/{noteId}和上传文件POST /personal-notes/attachments.
要使用密钥验证这一点,请求不会更改任何内容,应该被拒绝。:
// Personal notes belong to the person in the app: a key is refused with 403 SESSION_REQUIRED.
const API = process.env.VISH_API ?? 'https://d1.vish-app.ru/api/v1'
const KEY = process.env.VISH_API_KEY
if (!KEY) throw new Error('set VISH_API_KEY')
const response = await fetch(`${API}/personal-notes`, { headers: { 'X-Api-Key': KEY } })
const body = await response.json()
if (response.status !== 403 || body.error?.code !== 'SESSION_REQUIRED') {
throw new Error(`expected 403 SESSION_REQUIRED, got ${response.status} ${JSON.stringify(body)}`)
}
console.log('refused as designed:', body.error.code)示例:组类的注释
该示例使用注释查找组的类(notesCount > 0)并阅读第一个的笔记。 该组是VISH_GROUP,与ШАД-111默认情况下。
// Find a group's lessons that carry notes and read the notes of one; no key needed.
const API = process.env.VISH_API ?? 'https://d1.vish-app.ru/api/v1'
const GROUP = process.env.VISH_GROUP ?? 'ШАД-111'
const get = async (path) => {
const response = await fetch(`${API}${path}`)
if (!response.ok) throw new Error(`${path}: HTTP ${response.status}`)
return response.json()
}
const lessons = (await get(`/schedule?group=${encodeURIComponent(GROUP)}&all=1`)).list
if (lessons.length === 0) throw new Error(`no lessons for ${GROUP}`)
const withNotes = lessons.filter((lesson) => lesson.notesCount > 0)
const lesson = withNotes[0] ?? lessons[0]
const notes = await get(`/schedule/${lesson.id}/notes`)
if (!Array.isArray(notes.list) || notes.list.some((note) => note.lessonId !== lesson.id)) {
throw new Error('unexpected notes answer')
}
console.log(`${GROUP}: ${lessons.length} lessons, ${withNotes.length} with notes`)
console.log(`${lesson.date.slice(0, 10)} ${lesson.subject.ru}: ${notes.list.length} notes`)
for (const note of notes.list) console.log('-', note.content.slice(0, 80), `(${note.attachments.length} files)`)反应
GET /schedule/{id}/reactions -对课程的反应,向所有人开放; GET /reactions/config -什么反应是允许的。 您可以设置或删除您的反应(POST /schedule/{id}/reactions)只有登录后-与密钥太,你不需要任何特殊的权利。
尝试
替代品id课程外GET /schedule:
试一试请求
只有带锁的方法需要密钥。密钥只保存在本页:不会被存储,只作为本次请求的请求头发送,离开页面后即被清除。 如何获取密钥
验证:2026-10,PWA aa337c45,平台bff65fce._