Using observable queries with curl
You can explore a live query without writing frontend code. These commands run against the Tasks sample on 127.0.0.1:3000; replace the route with your own query’s route from /.cratis/queries.
Read the current snapshot
Section titled “Read the current snapshot”curl -i http://127.0.0.1:3000/api/tasks/listing/observe-all-tasks| Status | Meaning |
|---|---|
| 200 | The source has a current value; data holds it and isReady is true |
| 202 | No value yet; isReady is false. This is not a failure |
| 403 | Not authorized, or an emission guard denied the snapshot |
| 503 | A subscription limit is reached; retry after Retry-After |
Wait for the first result
Section titled “Wait for the first result”curl 'http://127.0.0.1:3000/api/tasks/listing/observe-all-tasks?waitForFirstResult=true&waitForFirstResultTimeout=5'For a pending source, waitForFirstResult=true waits for its first emission. The default wait is 30 seconds; waitForFirstResultTimeout accepts a positive number of seconds up to 120. A timeout answers 408; a source that completes before its first value answers 500. Invalid wait options answer 400. Booleans are case-insensitive (True works), and an unrecognized boolean is rejected, where Arc on .NET ignores it. Arc on .NET also accepts larger timeouts; this server bounds them to avoid retaining unlimited subscriptions.
Stream updates
Section titled “Stream updates”curl -N -H 'Accept: text/event-stream' http://127.0.0.1:3000/api/tasks/listing/observe-all-tasks-N turns off buffering. You receive one data: <query result JSON> frame now and one for every change; register a task in another terminal to see the next one. Press Ctrl+C to end the subscription; the server releases the source.
Structured arguments
Section titled “Structured arguments”A GET passes arguments in the query string. To send structured arguments to an observable query, use the HTTP QUERY method, which answers with a snapshot.
Related
Section titled “Related”- Observable queries
- Introspection to list query routes