Explore Capture with the Echo API

Optic's Echo API can be used to explore Optic Capture without the need for a "real" API. The service responds to any endpoint and HTTP method, and allows you to tailor the response you'll receive by setting certain headers.

NameDescriptionRequiredDefault
x-response-jsonThe JSON body for the response.yesnone
x-response-codeThe HTTP status code for the response.no200

The Echo API is available at the URL: https://echo.o3c.org (opens in a new tab)

Usage

Consider the following request made with Curl,

 curl -is https://echo.o3c.org/users/create -XPOST -d '{"name":"nate"}' -H 'x-response-json:{"id":0,"name":"nate"}' -H 'x-response-code:{"201"}'
HTTP/2 201
date: Tue, 24 Oct 2023 14:25:39 GMT
content-type: application/json; charset=utf-8
content-length: 22
 
{"id":0,"name":"nate"}

We made a POST request to the /users/create endpoint with a JSON payload ({"name":"nate"}), while the x-response-json and x-response-code headers told the Echo API how to respond.

You can make an identical request directly in your optic.yml file,

optic.yml
capture:
  openapi.yml:
    server:
      url: https://echo.o3c.org
    requests:
      send:
        - path: /users/create
          method: POST
          data:
            name: nate
          headers:
            x-response-json: '{"id":0, "name":"nate"}'
            x-response-code: "201"

Running optic capture openapi.yml --update interactive will create an OpenAPI specification documenting this request.

You can continue to explore Capture by adding, removing, or modifying requests and running optic capture again.