INTEGRATIONS / HTTP RECIPE

Vera, meet Go.

The generated Go example sets a bounded timeout, sends JSON and fails loudly on non-2xx responses.

← All integrations

Your first connection.

  1. 01

    Use Go 1.20 or newer and keep VERA_API_KEY in the server environment.

  2. 02

    Set VERA_BASE_URL to your Vera origin without a trailing slash.

  3. 03

    Copy the Go example below, run gofmt, then inspect the request ID and response before adding a larger batch.

Build the request.

Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.

package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
  "os"
  "time"
)

func main() {
  request, err := http.NewRequest("POST", os.Getenv("VERA_BASE_URL")+"/api/vera/v1/scrape", bytes.NewBufferString("{\n  \"url\": \"https://example.com\"\n}"))
  if err != nil { panic(err) }
  request.Header.Set("Authorization", "Bearer "+os.Getenv("VERA_API_KEY"))
  request.Header.Set("Content-Type", "application/json")
  response, err := (&http.Client{Timeout: 45 * time.Second}).Do(request)
  if err != nil { panic(err) }; defer response.Body.Close()
  body, _ := io.ReadAll(response.Body)
  if response.StatusCode < 200 || response.StatusCode >= 300 { panic(fmt.Sprintf("Vera HTTP %s: %s", response.Status, body)) }
  fmt.Println(string(body))
}

This edits a code example. It does not send a request or use credits.

Run a request in your workspace
YOUR PRIVACY

Choose what works for you. You can reopen these settings from the footer at any time.

Essential

Always active

Sign-in, security and preferences you ask us to remember. These keep the service working.

Analytics

Optional Vera visitor reporting counts visits and active browsers; Google Analytics may also measure selected clicks. We don’t send form contents, requested URLs, search queries, passwords, API keys or account emails. Turn it off here at any time.

Advertising

Not in use

No advertising cookies or remarketing tags.

Your choice is stored on this browser for 180 days. Read the cookie policy ↗