Assign an App license to device (App Store API)
zsh · curlUse the App Store API to assign a device license. You need a VPP (sToken), create a location, purchase app and download from Business > Settings > Payments and Billing > Content Tokens > [LOCATION] Fill in variables for your App's adamID, the path to your Token and the serial number of the device.
# Replace PATH_TO_TOKEN and adamID and serial
#!/bin/zsh
# import bearer token downloaded from
# Business > Settings > Payments and Billing > Content Tokens > [LOCATION]
##########################################################################
# VARIABLES
##########################################################################
# The name of your sToken or path if in a different folder
yourToken="PATH_TO_TOKEN"
# Bring in the sToken as Bearer Token
access_token=$(cat "$yourToken")
curl --location 'https://vpp.itunes.apple.com/mdm/v2/assets/associate' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $access_token" \
--data '{
"assets": [
{
"adamId": "1548193893",
"pricingParam": "STDQ"
}
],
"serialNumbers": [
"DMPC50ALPV13"
]
}'