Grafana k6 REST and WS Play

Collection of HTTP and WebSocket APIs for experimentation with k6

Note that this is a shared testing environment - please avoid high-load tests. This project is available here.


Public APIs

GET /public/crocodiles/ Public endpoint. List all public crocodiles.
GET /public/crocodiles/{id}/ Public endpoint. Get a single public crocodile.

Registration and authentication

POST /user/register/ Public endpoint. Register a new user.
POST /auth/cookie/login/ Public endpoint. Cookie/Session based authentication login.
POST /auth/cookie/logout/ Private endpoint. Cookie/Session logout.
POST /auth/basic/login/ Public endpoint. HTTP basic-auth login.
POST /auth/token/login/ Public endpoint. Bearer/JWT token authentication.

Private APIs

GET /my/crocodiles/ Private endpoint. List all your crocodiles
GET /my/crocodiles/{id}/ Private endpoint. Get a single crocodile.
POST /my/crocodiles/ Private endpoint. Create a new crocodile (max 100).
PUT /my/crocodiles/{id}/ Private endpoint. Update your crocodile.
PATCH /my/crocodiles/{id}/ Private endpoint. Update selected fields on your crocodile.
DELETE /my/crocodiles/{id}/ Private endpoint. Remove your crocodile.

WebSocket APIs

CONNECT /ws/crocochat/{room-name}/ WS URL to join chat in {room-name}.
message out
  "event": "SET_NAME",
  "new_name": "MyName"
Outgoing WebSocket message. Sets the User name in the chat
message out
  "event": "SAY",
  "message": "Hello"
Outgoing WebSocket message. Sends message to everyone in the room
message in
  "event": "USER_JOINED",
  "user": "username",
  "room": "room-name"
Incoming WebSocket message. Someone joined the chat
message in
  "event": "CHAT_MSG",
  "user": "username",
  "room": "room-name",
  "message": "message"
Incoming WebSocket message. Received by everyone in the room after user sends a `SAY` message
message out
  "event": "LEAVE",
  "user": "username",
  "room": "room-name"
Incoming/outgoing WebSocket message. Sent by user who wants to leave. Received by everyone in the room

k6 Examples

api_demo.js Register user, login and logout. Retrieve, modify, verify and delete crocodiles.
basic_auth.js Basic authentication. List my crocodiles and check response.
chaijs_httpx_demo.js Demo example to show how to use k6chaijs and httpx libraries.
cookie_auth.js Authenticate via login endpoint. Store auth token in a cookie. List crocodiles, verify response, and log out.
multiusers_demo.js Register random number of crocodiles.
token_auth.js Authenticate via login endpoint. Set auth token in header. List crocodiles and verify response.
ws_demo.js Demo example for the WS endpoint.