This is an example of a web (micro)service with machine-processable OpenAPI description.
Visit /chat with your browser to see all messages on an HTML page.
Visit /api/messages with your browser to get all messages in JSON format. The same data can be obtained from command line:
curl 'http://localhost:8080/api/messages'
Post a new message using command line:
curl -X 'POST' \ 'http://localhost:8080/api/messages?author=Joe' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "text": "Hello! 😀", "textColor": "black", "backgroundColor": "lightgray" }'
Automatically generated OpenAPI description is available in two formats:
Open the OpenAPI description in Swagger UI and try to call the service.