Facebook Pixel
Fit'DistanceDocumentation
Open the app
On this page

Follow a group of students automatically

Tag a group of students, read their pending check-ins every morning, write the feedback and set the check-in to done.

A tag gathers the students you want to follow closely. Every morning, this use case reads their pending check-ins, writes a feedback and marks the check-in as done. It writes in your name: it needs a key with Students › Read and Write (students:read, students:write), Check-ins › Read and Write (bilans:read, bilans:write) and the sensitive scope bilans.medical:read, which lets you read a check-in's comments. It also needs an offer that includes writes. Create the key in the app, terms of use accepted.

What this use case does

  1. Create the tag, once: POST /operations/students.tag_create with {"name": "auto"}. The reply gives the tag's uid.
  2. Put it on the students you follow: POST /operations/students.tags_set with {"studentId": 42, "tagUids": ["<uid>"], "mode": "add"}.
  3. Every morning: GET /bilans?status=PENDING&tag=<uid>, through all pages.
  4. Read the check-in and its thread: GET /bilans/{id}, then POST /operations/bilans.comments_list with {"bilanId": 7}.
  5. Write the feedback: POST /operations/bilans.comment_create with dry_run: true first, without an idempotency key, then the real write with the header Idempotency-Key: retour-<bilanId>.
  6. Mark the check-in done: POST /operations/bilans.set_status with {"bilanId": 7, "status": "DONE"}.
curl -X POST https://api.fitdistance.io/api/partner/v1/operations/bilans.comment_create \
  -H "Authorization: Bearer fd_live_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"bilanId": 7, "content": "Assistant (IA) de Léa Coach — …", "dry_run": true}'

When the preview looks right, replay the call without dry_run, with the header Idempotency-Key: retour-7. See Writes and idempotency.

What it costs

Each call costs one credit. The preview with dry_run: true is free.

What to know

  • The feedback is signed with the coach's name. If an AI writes it, it introduces itself in the text, for example "Assistant (IA) de Léa Coach — …".
  • A team key (team:read) reads the trainers' check-ins, but bilans.comment_create and bilans.set_status on one of them answer 404, like any check-in that does not belong to the key's coach.
  • A tag belongs to the coach who created it.
  • bilans.comments_list needs the sensitive scope bilans.medical:read.

See Scopes for the detail of each scope.

Next pageThe OpenAPI contractWhere to read the OpenAPI contract of the API, how to generate a client with one command, and why the reference on this site says the same thing.