boxes-api/getitemsinbox.bash

22 lines
674 B
Bash
Raw Normal View History

#!/bin/bash
# API base URL
API_BASE_URL="http://localhost:8080" # Replace with your actual API base URL
# Box ID
2024-10-10 02:20:58 +00:00
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"