Documenting a Network Service Endpoint
A service endpoint contract should identify how to address an operation, which data it accepts, and which observable outcomes callers handle.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a routing example
A read operation can specify a document identifier, a response representation, and a missing-document result. Give an example with a successful and missing ID. HTTP status families help select stable observable behavior.
Check representation details
State whether an omitted field takes a default and how unsupported formats are reported. Required and optional fields define the payload expectation independently of transport.[1][2]
Make one request and result sufficient to verify the contract
A catalogue endpoint can specify method GET, resource path /items/{id}, accepted ID format, returned media type and the meaning of a missing item. An example should show a valid record and a documented failure. See HTTP status families.
GET /items/7 → 200 with a JSON item under the example contract
GET /items/99 → 404 with a documented error shape
A malformed ID may have its own defined outcome
Include context that affects correct use
State versioning, pagination or access requirements when relevant to the operation. Use a synthetic ID and known fixture in an integration test. Verify documented behavior as well as server status.