Перейти к содержимому

Коллекция API

Tetiva Playground

20 запросов · 7 папок

One host, four protocols, 20 requests. Tetiva Playground at playground.tetiva.app answers with what you sent, any status you ask for, as slowly as you like. No key, nothing stored, not a proxy. The two streaming gRPC calls are in the gRPC folder as grpcurl commands.

Папка

REST · Echo#

Every echo answers with the method, URL, query (as args), headers and body it received, plus a request_id. A JSON body comes back raw in data and parsed in json; forms and multipart uploads come back in form and files.

REST · Echo

Echo a GET#

GEThttps://playground.tetiva.app/get?source=docs&page=2

Returns your request as JSON: query parameters in args, headers in headers, your IP in origin.

Параметры запроса · 2

sourcedocs
page2
curl 'https://playground.tetiva.app/get?source=docs&page=2'

Примеры ответов

REST · Echo

Echo my POST body#

POSThttps://playground.tetiva.app/post

Send a JSON body and get it back: raw in data, parsed in json. Bodies go up to 1 MB; forms and multipart files come back in form and files.

Заголовки · 1

Content-Typeapplication/json

Тело · JSON

{"hello":"world"}
curl -X POST 'https://playground.tetiva.app/post' \
  -H 'Content-Type: application/json' \
  --data-raw '{"hello":"world"}'

Примеры ответов

REST · Echo

Echo a PUT#

PUThttps://playground.tetiva.app/put

The same echo for PUT: the body comes back in data and json.

Заголовки · 1

Content-Typeapplication/json

Тело · JSON

{
  "id": 42,
  "name": "Ada Lovelace",
  "role": "admin"
}
curl -X PUT 'https://playground.tetiva.app/put' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": 42,
  "name": "Ada Lovelace",
  "role": "admin"
}'

Примеры ответов

REST · Echo

Echo a PATCH#

PATCHhttps://playground.tetiva.app/patch

The same echo for PATCH, handy for partial updates.

Заголовки · 1

Content-Typeapplication/json

Тело · JSON

{
  "role": "viewer"
}
curl -X PATCH 'https://playground.tetiva.app/patch' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "role": "viewer"
}'

Примеры ответов

REST · Echo

Echo a DELETE#

DELETEhttps://playground.tetiva.app/delete?id=42

The same echo for DELETE. A body is allowed and comes back too.

Параметры запроса · 1

id42
curl -X DELETE 'https://playground.tetiva.app/delete?id=42'

Примеры ответов

REST · Echo

Any method, any path#

POSThttps://playground.tetiva.app/anything/orders/42?dry_run=true

/anything and every path under it echo any method, custom ones included, so you can stand in for a route that doesn't exist yet.

Параметры запроса · 1

dry_runtrue

Заголовки · 1

Content-Typeapplication/json

Тело · JSON

{
  "status": "shipped"
}
curl -X POST 'https://playground.tetiva.app/anything/orders/42?dry_run=true' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "status": "shipped"
}'

Примеры ответов

REST · Echo

See my headers#

GEThttps://playground.tetiva.app/headers

Returns only the headers the server received. Useful to check what your client, proxy or SDK adds.

Заголовки · 1

X-Debug1
curl 'https://playground.tetiva.app/headers' \
  -H 'X-Debug: 1'

Примеры ответов

Папка

REST · Status codes and delays#

Make the server fail or stall on purpose: any status from 200 to 599, or a wait of up to 10 seconds.

REST · Status codes and delays

Any status code#

GEThttps://playground.tetiva.app/status/418

Answers with the status in the path, from 200 to 599. Redirects point to /get, 401 adds WWW-Authenticate, 429 and 503 add Retry-After.

curl 'https://playground.tetiva.app/status/418'

Примеры ответов

REST · Status codes and delays

Slow response#

GEThttps://playground.tetiva.app/delay/2

Waits the number of seconds in the path, up to 10, then answers; fractions work too, as in /delay/0.5. Good for testing timeouts and loading states.

curl 'https://playground.tetiva.app/delay/2'

Примеры ответов

Папка

REST · Auth#

Check that your client sends credentials, and that it copes with the 401 when it doesn't.

REST · Auth

Bearer auth#

GEThttps://playground.tetiva.app/bearer

Any non-empty token passes and comes back in token. Without Authorization: Bearer … you get 401 with WWW-Authenticate: Bearer.

Авторизация

Bearer

prefixBearer
tokentest-token
curl 'https://playground.tetiva.app/bearer' \
  -H 'Authorization: Bearer test-token'

Примеры ответов

REST · Auth

Basic auth#

GEThttps://playground.tetiva.app/basic-auth/tetiva/playground

Passes when the Basic credentials match the user and password in the path, here tetiva / playground. Anything else gets 401.

Авторизация

Basic

passwordplayground
usernametetiva
curl 'https://playground.tetiva.app/basic-auth/tetiva/playground' \
  -H 'Authorization: Basic dGV0aXZhOnBsYXlncm91bmQ='

Примеры ответов

Папка

REST · Fake data#

Five fake users for lists, tables and pagination. The data is the same every time, and POST /users answers as if it worked but stores nothing.

REST · Fake data

Fake users#

GEThttps://playground.tetiva.app/users?limit=3

A page of fake users. limit takes 1 to 5, and next links to the following page until it is null.

Параметры запроса · 1

limit3
curl 'https://playground.tetiva.app/users?limit=3'

Примеры ответов

REST · Fake data

One fake user#

GEThttps://playground.tetiva.app/users/2

One user by id, from 1 to 5. Any other id gets 404 with a hint.

curl 'https://playground.tetiva.app/users/2'

Примеры ответов

REST · Fake data

Create a user#

POSThttps://playground.tetiva.app/users

Checks name and email and answers 201 with the new user and a Location header. Nothing is stored: stored is false.

Заголовки · 1

Content-Typeapplication/json

Тело · JSON

{
  "name": "Grace Hopper",
  "email": "grace@example.com",
  "role": "editor"
}
curl -X POST 'https://playground.tetiva.app/users' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "Grace Hopper",
  "email": "grace@example.com",
  "role": "editor"
}'

Примеры ответов

Папка

GraphQL#

A small library at https://playground.tetiva.app/graphql: books, authors and one mutation. Introspection is on, so any GraphQL client can load the schema.

GraphQL

Run a GraphQL query#

GraphQLhttps://playground.tetiva.app/graphql

Операция: Books

Lists books with their authors. first takes 1 to 50; a field that doesn't exist gets an error that lists the real ones.

Запрос GraphQL

query Books($first: Int) {
  books(first: $first) {
    id
    title
    author {
      name
    }
  }
}

Переменные

{
  "first": 2
}
curl -X POST 'https://playground.tetiva.app/graphql' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"query Books($first: Int) {\n  books(first: $first) {\n    id\n    title\n    author {\n      name\n    }\n  }\n}","variables":{"first":2},"operationName":"Books"}'

Примеры ответов

GraphQL

One book by id#

GraphQLhttps://playground.tetiva.app/graphql

Операция: Book

Fetches one book. An unknown id returns "book": null, not an error.

Запрос GraphQL

query Book($id: ID!) {
  book(id: $id) {
    title
    year
    author {
      name
    }
  }
}

Переменные

{
  "id": "3"
}
curl -X POST 'https://playground.tetiva.app/graphql' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"query Book($id: ID!) {\n  book(id: $id) {\n    title\n    year\n    author {\n      name\n    }\n  }\n}","variables":{"id":"3"},"operationName":"Book"}'

Примеры ответов

GraphQL

Add a book#

GraphQLhttps://playground.tetiva.app/graphql

Операция: AddBook

A mutation that returns the new book with id 6. Nothing is stored: extensions.stored is false.

Запрос GraphQL

mutation AddBook($title: String!, $authorId: ID!) {
  addBook(title: $title, authorId: $authorId) {
    id
    title
    author {
      name
    }
  }
}

Переменные

{
  "title": "Carmilla",
  "authorId": "a5"
}
curl -X POST 'https://playground.tetiva.app/graphql' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"mutation AddBook($title: String!, $authorId: ID!) {\n  addBook(title: $title, authorId: $authorId) {\n    id\n    title\n    author {\n      name\n    }\n  }\n}","variables":{"title":"Carmilla","authorId":"a5"},"operationName":"AddBook"}'

Примеры ответов

Папка

gRPC#

echo.v1.EchoService on playground.tetiva.app:443 with TLS and server reflection, so clients find the methods without a .proto file.

Reflection

grpcurl playground.tetiva.app:443 list
grpcurl playground.tetiva.app:443 describe echo.v1.EchoService

Streams. ServerStream and Chat stream, so they are not in this collection. Run them with grpcurl:

grpcurl -d '{"text":"ping","count":3,"interval_ms":500}' playground.tetiva.app:443 echo.v1.EchoService/ServerStream
grpcurl -d @ playground.tetiva.app:443 echo.v1.EchoService/Chat <<'EOF'
{"text":"hello"}
{"text":"still there?"}
EOF

gRPC

Echo (unary)#

gRPCgrpcs://playground.tetiva.app

echo.v1.EchoService / Echo

Returns your text with seq, server_time and the request metadata as the server saw it.

Сообщение

{
  "text": "ping"
}
grpcurl -d '{
  "text": "ping"
}' \
  'playground.tetiva.app:443' \
  'echo.v1.EchoService/Echo'

Примеры ответов

Папка

WebSocket#

Text and binary frames up to 64 KB. /ws closes after 60 seconds without a message, with 1000 Normal Closure; every session ends after 10 minutes.

WebSocket

Echo over WebSocket#

WebSocketwss://playground.tetiva.app/ws

Every frame you send comes straight back, text or binary, up to 64 KB a frame.

Сообщения · 1

helloТекст

hello
printf '%s' 'hello' | websocat 'wss://playground.tetiva.app/ws'

WebSocket

Ticker#

WebSocketwss://playground.tetiva.app/ws/ticker

Pushes {"tick": n, "at": …} every second until you disconnect. Nothing to send.

websocat 'wss://playground.tetiva.app/ws/ticker'