datacontract api
Start the datacontract CLI as server application with REST API. The OpenAPI documentation as Swagger UI is available on http://localhost:4242. You can execute the commands directly from the Swagger UI. To protect the API, you can set the environment variable DATACONTRACT_CLI_API_KEY to a secret API key. To authenticate, requests must include the header 'x-api-key' with the correct API key. This is highly recommended, as data contract tests may be subject to SQL injections or leak sensitive information. To connect to servers (such as a Snowflake data source), set the credentials as environment variables as documented in https://cli.datacontract.com/#test It is possible to run the API with extra arguments for uvicorn.run() as keyword arguments, e.g.: datacontract api --port 1234 --root_path /datacontract.
datacontract api [OPTIONS]
| Option | Default | Description |
|---|---|---|
--port | 4242 | Bind socket to this port. |
--host | 127.0.0.1 | Bind socket to this host. Hint: For running in docker, set it to 0.0.0.0 |
--debug / --no-debug | — | Enable debug logging |
datacontract api --port 4242 --host 0.0.0.0
Guide: Run as a web server.