Add a new cheese
curl -X POST 'https://cheese.example.com/v2/cheeses' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Gorgonzola",
    "category": {
      "name": "Blue cheese"
    },
    "origin": "Italy",
    "pricePerKg": 28.5
  }'
const response = await fetch('https://cheese.example.com/v2/cheeses', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
      "name": "Gorgonzola",
      "category": {
        "name": "Blue cheese"
      },
      "origin": "Italy",
      "pricePerKg": 28.5
    }),
});

const data: Record<string, unknown> = await response.json();
import requests

payload = {
  "name": "Gorgonzola",
  "category": {
    "name": "Blue cheese"
  },
  "origin": "Italy",
  "pricePerKg": 28.5
}

response = requests.post('https://cheese.example.com/v2/cheeses', json=payload)
data = response.json()
package main

import (
  "fmt"
  "io"
  "net/http"
  "strings"
)

func main() {
  body := strings.NewReader(`{
    "name": "Gorgonzola",
    "category": {
      "name": "Blue cheese"
    },
    "origin": "Italy",
    "pricePerKg": 28.5
  }`)
  req, _ := http.NewRequest("POST", "https://cheese.example.com/v2/cheeses", body)
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  data, _ := io.ReadAll(resp.Body)
  fmt.Println(string(data))
}
use reqwest;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let client = reqwest::Client::new();
    let body = serde_json::json!({
      "name": "Gorgonzola",
      "category": {
        "name": "Blue cheese"
      },
      "origin": "Italy",
      "pricePerKg": 28.5
    });
    let response = client.post("https://cheese.example.com/v2/cheeses")
        .json(&body)
        .send()
        .await?
        .text()
        .await?;
    println!("{}", response);
    Ok(())
}