#!/bin/bash

# API base URL
API_BASE_URL="http://localhost:8080" # Replace with your actual API base URL

# Box ID
BOX_ID=96 # Replace with the actual box ID

# Login credentials
USERNAME="boxuser" # Replace with your actual username
PASSWORD="boxuser" # Replace with your actual password

# Get a new JWT token
TOKEN=$(curl -s -X POST -H "Content-Type: application/json" \
  -d "{\"username\":\"$USERNAME\", \"password\":\"$PASSWORD\"}" \
  "$API_BASE_URL/login" | jq -r '.token')

# Request items in the specified box using the obtained token
curl -s -X GET -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "$API_BASE_URL/boxes/$BOX_ID/items"
