Powered by AppSignal & Oban Pro

Izi Hub Playground

playground.livemd


title: Izi Hub Playground description: Try the core API workflows through the deployed Livebook app.


Izi Hub Playground

# Pre Setup
Mix.install([
  {:kino, "~> 0.18.0"}
])

Section

Izi Hub Playground

Setup

Mix.install([
  {:req, "~> 0.5"},
  {:jason, "~> 1.4"},
  {:kino, "~> 0.18.0"}
])

support_path = Path.expand("notebooks/_support/http.ex", File.cwd!())
Code.require_file(support_path)
base_url = System.get_env("IZI_HUB_BASE_URL", "http://localhost:4000")
client = Core.Notebooks.HTTP.client(base_url: base_url)

Recipe template

Replace the path and payload with real API endpoints.

path = "/api/your_endpoint"
payload = %{example: "value"}

resp = Core.Notebooks.HTTP.post_json(client, path, payload)

%{status: resp.status, body: resp.body}

Authenticated requests

token = System.get_env("IZI_HUB_TOKEN") || "REPLACE_ME"

client_with_auth =
  Core.Notebooks.HTTP.client(
    base_url: base_url,
    headers: [
      {"authorization", "Bearer " <> token},
      {"content-type", "application/json"}
    ]
  )