2018-07-31 07:44:45 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head><title>Sample Chat</title></head>
|
|
|
|
<body>
|
|
|
|
<pre><code># Ask for an auth code (swap sub)
|
2018-08-02 01:13:10 +00:00
|
|
|
curl -X POST http://localhost:4080/api/sessions \
|
2018-07-31 07:44:45 +00:00
|
|
|
-H 'Content-Type: application/json; charset=utf-8' \
|
2018-08-02 08:13:56 +00:00
|
|
|
-d '{"sub":"<strong><em>jon@example.com</em></strong>"}'
|
2018-07-31 07:44:45 +00:00
|
|
|
|
|
|
|
# Validate auth code (swap session id, sub, and otp)
|
2018-08-02 08:13:56 +00:00
|
|
|
curl -X POST http://localhost:4080/api/sessions/<strong><em>xyz</em></strong> \
|
2018-07-31 07:44:45 +00:00
|
|
|
-H 'Content-Type: application/json; charset=utf-8' \
|
2018-08-02 08:13:56 +00:00
|
|
|
-d '{"otp":"<strong><em>secret123</em></strong>"}'
|
2018-07-31 07:44:45 +00:00
|
|
|
|
|
|
|
# Post a message (swap api-token)
|
2018-08-02 01:13:10 +00:00
|
|
|
curl -X POST http://localhost:4080/api/rooms/general \
|
2018-08-02 08:13:56 +00:00
|
|
|
-H 'Authorization: Bearer <strong><em>api-token</em></strong>' \
|
2018-07-31 07:44:45 +00:00
|
|
|
-H 'Content-Type: application/json; charset=utf-8' \
|
2018-08-02 08:13:56 +00:00
|
|
|
-d '{"message":"Hello, World!"}'
|
2018-07-31 07:44:45 +00:00
|
|
|
|
|
|
|
# Get a room's messages (swap api-token, since unix-epoch)
|
2018-08-02 01:13:10 +00:00
|
|
|
curl http://localhost:4080/api/rooms/general?since=0 \
|
2018-08-02 08:13:56 +00:00
|
|
|
-H 'Authorization: Bearer <strong><em>api-token</em></strong>'
|
2018-07-31 07:44:45 +00:00
|
|
|
</code></pre>
|
|
|
|
</body>
|
|
|
|
</html>
|