Add a new cheese
curl -X POST 'https://cheese.example.com/v2/cheeses' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "Gorgonzola",
  "category": {
    "name": "Blue cheese"
  },
  "origin": "Italy",
  "pricePerKg": 28.5
}'
const body = `{
  "name": "Gorgonzola",
  "category": {
    "name": "Blue cheese"
  },
  "origin": "Italy",
  "pricePerKg": 28.5
}`;

const response = await fetch('https://cheese.example.com/v2/cheeses', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
import requests

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

response = requests.post(
    'https://cheese.example.com/v2/cheeses',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
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("Authorization", "Bearer YOUR_TOKEN")
  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 = r#"{
  "name": "Gorgonzola",
  "category": {
    "name": "Blue cheese"
  },
  "origin": "Italy",
  "pricePerKg": 28.5
}"#;
    let response = client.post("https://cheese.example.com/v2/cheeses")
        .body(body)
        .header("Authorization", "Bearer YOUR_TOKEN")
        .header("Content-Type", "application/json")
        .send()
        .await?
        .text()
        .await?;
    println!("{}", response);
    Ok(())
}