Make safe idempotent writes
Waqar write access is separately entitled, rolled out, and authorized. Do not deploy write code until the school confirms that the exact write scopes are effective.
Supported mutations
Section titled “Supported mutations”- Create or update a student.
- Create, update, or end a session.
- Create or update the supplied students’ session attendance in one batch; omitted students remain unchanged.
- Record a recitation in a session.
Learning Plans are read-only in API v1.
Request requirements
Section titled “Request requirements”- Use
Content-Type: application/json. - Keep the complete body at or below 1 MiB.
- Send only fields defined by the current schema; unknown fields are rejected.
- Use documented enum, UUID, date, Quran-range, and rating constraints.
- Attendance batches contain 1–1,000 unique students.
- In a patch, an omitted field means “leave unchanged”; an explicit supported
nullcan clear a nullable field.
Idempotency rules
Section titled “Idempotency rules”POST creation and attendance PUT require an Idempotency-Key. The value
must be 1–255 visible ASCII characters (! through ~; spaces are not
allowed). Student and session patches and the session-end action accept one
optionally.
For each logical operation:
- Generate a high-entropy value in the calling service.
- Persist it with the pending job before sending.
- Send the same value with the exact same method, route, query, and body for a retry.
- Keep it secret from logs, traces, URLs, and user interfaces.
- Retain the mapping through Waqar’s seven-day replay window.
An exact successful replay returns the stored response. Reusing the value for
a different request returns 409 idempotency_key_conflict. A concurrent
duplicate can return 409 idempotency_request_in_progress; wait for
Retry-After and retry the exact request.
Safe write sequence
Section titled “Safe write sequence”- Read and validate prerequisite identifiers in the same tenant.
- Validate the outgoing body locally against OpenAPI.
- Send the minimum-scope key and idempotency value.
- On
201, store the returneddata.idandLocation. - On
200, reconcile the returned resource. - On
422, correct the business input; do not retry unchanged. - On
409, distinguish lifecycle conflict from idempotency behavior. - On uncertain transport failure, retry only with the original idempotency value and identical request.
- Follow with a read when the integration needs durable confirmation.
Never turn a rejected write into undocumented mutations. See errors and quotas and resources.