Files
SecondBrain/99 System/Archive/Работа с API для проекта Attendance Mephi.md
2026-05-31 10:18:48 +03:00

1.8 KiB

status, type, tags, created, updated, aliases
status type tags created updated aliases
seed concept
2025-12-17 2026-05-25

API Импорт

Команда Rails:

/home/ada/.local/bin/mise exec ruby -- bin/rails runner '...'

Семестр берётся из Term.actual. Для старта 2026-02-07 код семестра: 20252.

Credentials

api:
  home_mephi:
    host:
    code:
    token:
  students_mephi:
    host:
    username:
    password:

Endpoints

GET {home_mephi.host}/study_groups.json?term_code=20252&code=...&token=...
GET {home_mephi.host}/tutors.json?term_code=20252&code=...&token=...
GET {students_mephi.host}/get_list_by_group_name?group=...&term=20252
GET {home_mephi.host}/tutors/{staff_id}/schedules.json?term_code=20252&date=YYYY-MM-DD&code=...&token=...

students_mephi использует Basic Auth: username/password.

Ручная загрузка

/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportGroupsService.execute'
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportTutorsService.execute'
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'ImportStudentsService.execute'
/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; ImportDisciplineService.execute(nil, term)'

Расписание на сегодня:

/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; ImportScheduleService.execute(Date.today, term)'

Расписание за весь семестр до сегодня:

/home/ada/.local/bin/mise exec ruby -- bin/rails runner 'term = Term.actual; finish = [term.get_finish_date, Date.today].min; (term.start_date..finish).each { |date| ImportScheduleService.execute(date, term) unless date.wday == 0 }'