Spec0docsCLI 0.7.0

Your first request

Add a spec, send a request built from it, and read the schema check, in about three minutes.

This walkthrough adds a public spec, sends one request, and shows where the result is kept. You need no account.

It uses the Swagger Petstore, a public demo API. Any OpenAPI 3.0, 3.1 or Swagger 2.0 spec works the same way.

Add the API

Press ⌘O (Ctrl+O on Windows and Linux), or Add API in the top right. The Add an API dialog has three tabs: Spec0, URL and Local file.

Choose URL, paste this address, and add it:

https://petstore3.swagger.io/api/v3/openapi.json

Studio downloads the spec, keeps a copy of it, and opens the API.

Pick an operation

The Operations view lists the API's operations by tag. Click GET /pet/findByStatus.

The request editor fills itself in from the spec. The status parameter is a dropdown, because the spec lists the values it allows. For an operation with a body, the body starts with the real field names and example values.

The address bar at the top shows where the request goes. Petstore's spec gives its server as a path, so Studio resolves it against the address you added the spec from: https://petstore3.swagger.io/api/v3.

Send it

Press Send, or ⌘↵ (Ctrl+Enter). The response appears on the right: the status, the time and size, and the body, headers, and the same request as a curl command.

Read the check

Above the body, Studio shows the result of checking the response against the spec:

  • Response matches the declared schema means the body fits what the spec promises for that status code.
  • A warning lists each difference by its JSON path: a field the spec doesn't mention, a required field that's missing, or a value of the wrong type.

Checking responses explains each result.

Look at it in History

Open History in the top bar. Every request you send is kept there on your computer for 30 days, with the response and the check result. A saved request opens read-only; to run it again, choose Copy to a new request.

What next

  • Point the request somewhere else: localhost, a staging server, or a local mock. See The address bar.
  • Keep a token out of the request: put it in an environment as a secret, and use {{token}}.
  • Chain a few requests into a flow that runs in one click: Collections.

Good to know

  • A spec you add from a file or a URL is copied into Studio, so it opens quickly, works offline, and still works if the file moves. See Specs and the library.
  • To send one request with no spec at all, use Scratch, pinned first in your library. See The scratch pad.
Was this helpful?

On this page