Files
Alte_Skripte/API_Inventory_Preeload.sh
2026-02-16 15:05:15 +01:00

43 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -x
serialNumber="C02F82CQMD6T"
assetTag="4215812"
deviceType="Computer"
username=""
# Generate a token
tokenResp=$(curl -k -u "USERNAME:PASSWORD" -X POST "https://jssurl.jamfcloud.com/uapi/auth/tokens" -H "accept: application/json")
# parse the token from the response
token=$(echo $tokenResp | awk -F '[:,{"}]' ' {print $6} ')
# pass the token into a cURL command
curl -X POST "https://jssurl.jamfcloud.com/api/v2/inventory-preload/records" -H "accept: application/json" -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d "{\"serialNumber\": \"$serialNumber\",
\"deviceType\": \"$deviceType\",
\"username\": \"$username\",
\"fullName\": \"\",
\"emailAddress\": \"\",
\"phoneNumber\": \"\",
\"position\": \"\",
\"department\": \"\",
\"building\": \"\",
\"room\": \"\",
\"poNumber\": \"\",
\"poDate\": \"\",
\"warrantyExpiration\": \"\",
\"appleCareId\": \"\",
\"lifeExpectancy\": \"\",
\"purchasePrice\": \"\",
\"purchasingContact\": \"\",
\"purchasingAccount\": \"\",
\"leaseExpiration\": \"\",
\"barCode1\": \"\",
\"barCode2\": \"\",
\"assetTag\": \"$assetTag\",
\"vendor\": \"\",
\"extensionAttributes\": [
{
\"name\": \"\",
\"value\": \"\"
}
]
}"