Skip to content

Add API reference with example requests and responses - Fixes #29 - #52

Open
viralynn wants to merge 2 commits into
NxtLabTech:mainfrom
viralynn:fix/issue-29-api-examples
Open

viralynn wants to merge 2 commits into
NxtLabTech:mainfrom
viralynn:fix/issue-29-api-examples

Conversation

@viralynn

@viralynn viralynn commented Oct 7, 2026

Copy link
Copy Markdown

What changed?

Adds docs/api.md, an API reference for all 11 endpoints, and links it from the "API endpoints" section of the README.

Each endpoint has a curl example, a sample JSON response, the required fields and limits (255 and 2000 characters), and the possible error statuses (400, 404, 409) with example messages. The page also explains the position field and the date format (UTC, Y-m-d H:i:s).

The document describes the current behavior of main (commit a84e812). If #40, #41, or #42 are merged, the queue, error, and close sections will need updating.

Which issue does this address?

Fixes #29

How was it tested?

No code changed, so I did not run composer test or the Flutter tests.

I ran all 28 curl commands from the document against a fresh SQLite database started with composer start, and compared each result with the document. The status codes, headers, field names, and error messages all matched. Ids and timestamps differ from the samples, as expected.

I also checked these by hand:

  • A value of exactly 255 characters is accepted for title, mentor_name, student_name, and topic, and exactly 2000 characters for question.
  • For student_email, an address of 254 characters is accepted and one of 255 characters is rejected as not a valid email address.
  • skipped on a waiting doubt returns 400, like solved.
  • After closing a session, its waiting doubts stay WAITING.

Document all 11 endpoints with curl examples, sample responses, request fields and limits, and error messages. Link the new page from the README. Refs NxtLabTech#29
Some examples change data, so their results depend on the examples run before them. List the order that gives the results shown in the document, and tell readers to run the closed sessions example after closing session 1.
@viralynn viralynn changed the title Add API reference with example requests and responses Fixes #29 - Add API reference with example requests and responses Oct 8, 2026
@viralynn viralynn changed the title Fixes #29 - Add API reference with example requests and responses Add API reference with example requests and responses - Fixes #29 Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add example requests and responses to the API documentation

1 participant