Playground Endpoints
Complete reference for all playground endpoints.
HTTP REST API
Base URL: http://localhost:19510
Products
List Products
GET /api/products
Response:
{
"success": true,
"data": [
{
"id": 1,
"name": "Laptop Pro",
"price": 1299.99,
"category": "Electronics",
"inStock": true,
"description": "High-performance laptop"
}
]
}
Get Product
GET /api/products/{id}
Response:
{
"success": true,
"data": {
"id": 1,
"name": "Laptop Pro",
"price": 1299.99,
"category": "Electronics",
"inStock": true,
"description": "High-performance laptop"
}
}
Create Product
POST /api/products
Content-Type: application/json
{
"name": "New Product",
"price": 99.99,
"category": "Gadgets",
"inStock": true,
"description": "A new product"
}
Response (201):
{
"success": true,
"data": {
"id": 6,
"name": "New Product",
"price": 99.99,
"category": "Gadgets",
"inStock": true,
"description": "A new product"
}
}
Update Product
PUT /api/products/{id}
Content-Type: application/json
{
"name": "Updated Product",
"price": 149.99,
"category": "Electronics"
}
Delete Product
DELETE /api/products/{id}
Response:
{
"success": true,
"data": {
"deleted": 1
}
}
Utility Endpoints
Health Check
GET /health
Response:
{
"status": "healthy",
"service": "istek-playground",
"timestamp": "2024-01-15T10:30:00Z"
}
Root Info
GET /
Response:
{
"name": "Istek Playground",
"version": "1.0.0",
"endpoints": {
"rest": "/api/products",
"graphql": "/graphql",
"websocket": "/ws/echo",
"openapi": "/openapi.json",
"health": "/health"
}
}
Reset Data
POST /api/reset
Resets all data to initial state.
OpenAPI Spec
GET /openapi.json
Returns the OpenAPI 3.0 specification.
WebSocket
URL: ws://localhost:19510/ws/echo
Echo Service
Send any message and receive it back with metadata.
Send:
Hello, WebSocket!
Receive:
{
"type": "echo",
"original": "Hello, WebSocket!",
"timestamp": "2024-01-15T10:30:00Z"
}
Binary Messages
Binary messages are echoed back as-is.
SSE (Server-Sent Events)
URL: http://localhost:19510/sse/events
Event Stream
Connect to receive a continuous stream of server-sent events.
Request:
GET /sse/events
Accept: text/event-stream
Event Format:
event: message
data: {"count": 1, "message": "Event #1", "timestamp": "2024-01-15T10:30:00Z"}
event: message
data: {"count": 2, "message": "Event #2", "timestamp": "2024-01-15T10:30:01Z"}
Event Types
| Event | Description |
|---|---|
message | Regular event with counter and timestamp |
heartbeat | Keep-alive ping (every 30 seconds) |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
interval | number | 1000 | Milliseconds between events |
count | number | unlimited | Number of events before closing |
Example with parameters:
GET /sse/events?interval=2000&count=5
Sends 5 events, 2 seconds apart, then closes the connection.
Response Headers
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
Usage in Istek
- Create a new HTTP request
- Set method to GET
- Enter URL:
http://localhost:19510/sse/events - Set header:
Accept: text/event-stream - Send the request
- Events will stream in real-time
GraphQL
Endpoint: http://localhost:19510/graphql
Queries
List Users
query {
users {
id
name
email
createdAt
}
}
Get User by ID
query GetUser($id: ID!) {
user(id: $id) {
id
name
email
createdAt
}
}
Variables:
{
"id": "1"
}
Mutations
Create User
mutation CreateUser($name: String!, $email: String!) {
createUser(name: $name, email: $email) {
id
name
email
createdAt
}
}
Variables:
{
"name": "New User",
"email": "[email protected]"
}
Update User
mutation UpdateUser($id: ID!, $name: String, $email: String) {
updateUser(id: $id, name: $name, email: $email) {
id
name
email
}
}
Delete User
mutation DeleteUser($id: ID!) {
deleteUser(id: $id)
}
Schema SDL
GET /graphql/sdl
Returns the GraphQL schema in SDL format.
gRPC
Server: localhost:19512
Greeter Service
Reflection is enabled for automatic service discovery.
SayHello (Unary)
rpc SayHello(HelloRequest) returns (HelloReply)
Request:
{
"name": "World"
}
Response:
{
"message": "Hello, World! Welcome to Istek Playground.",
"timestamp": "2024-01-15T10:30:00Z"
}
SayHelloServerStream (Server Streaming)
rpc SayHelloServerStream(HelloRequest) returns (stream HelloReply)
Returns 5 messages with 1-second intervals.
Proto Definition
syntax = "proto3";
package playground;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
rpc SayHelloServerStream (HelloRequest) returns (stream HelloReply);
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
string timestamp = 2;
}
MQTT
Broker: localhost:19511
Connection
Host: localhost
Port: 19511
Client ID: (any unique ID)
No authentication required.
Topics
You can publish and subscribe to any topic:
sensors/temperature
home/living-room/lights
test/messages
Example
Publish:
Topic: sensors/temperature
QoS: 1
Message: {"value": 22.5, "unit": "celsius"}
Subscribe:
Topic: sensors/#
Unix Socket
Socket: /tmp/istek-playground.sock
Available on macOS and Linux only.
Usage
Same endpoints as HTTP REST API:
Socket: /tmp/istek-playground.sock
Method: GET
Path: /api/products
Quick Reference
| Protocol | URL/Address |
|---|---|
| REST API | http://localhost:19510/api/products |
| WebSocket | ws://localhost:19510/ws/echo |
| SSE | http://localhost:19510/sse/events |
| GraphQL | http://localhost:19510/graphql |
| GraphQL SDL | http://localhost:19510/graphql/sdl |
| OpenAPI | http://localhost:19510/openapi.json |
| gRPC | localhost:19512 |
| MQTT | localhost:19511 |
| Unix Socket | /tmp/istek-playground.sock |