package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
url := "https://api.example.com/users"
body := []byte(`{"email": "user@example.com", "password": "string", "display_name": "string", "roles": ["admin"], "addresses": [{"line1": "string", "line2": "string", "city": "string", "state": "string", "postal_code": "string", "country": "string"}]}`)
req, err := http.NewRequest("POST", url, bytes.NewBuffer(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer " + os.Getenv("API_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}