Use the Dell API to Automate PC Warranty Information Lookup with curl in BASH
Dell TechDirect customers can request access to the Dell API which can be used to programmatically lookup warranty information–no clicking through a captcha! See: https://techdirect.dell.com/portal/AboutAPIs.aspx
Code examples for PowerShell and a more complete explanation on how to work with this API have been previously published. See: Use the Dell API to Automate PC Warranty Information Lookup with PowerShell.
Here is an example that can be used in BASH on Linux. Edit the variables Dell_Api, Dell_Secret, and serial to lookup warranty information for a Dell serial number (Service Tag).
Thanks to Grace Wohlwinder for this code example.
#!/bin/bash
Dell_Api=""
Dell_Secret=""
Dell_OAuth="$(echo -n "$Dell_Api:$Dell_Secret" | base64 -w 0)"
Dell_Auth_Url=https://apigtwb2c.us.dell.com/auth/oauth/v2/token
Dell_Api_Url=https://apigtwb2c.us.dell.com/PROD/sbil/eapi/v5/asset-entitlements
serial=""
token="$(curl -s --request POST \
--url "$Dell_Auth_Url" \
--header "Authorization: Basic $Dell_OAuth" \
--data 'grant_type=client_credentials' | jq -r '.access_token')"
response="$(curl -s --request GET \
--url "$Dell_Api_Url?servicetags=$serial&Method=GET" \
--header "Accept: application/json" \
--header "Authorization: Bearer $token" | jq -r '')"
ship_date="$(echo $response | jq -r '.[].shipDate')"
support_end_date="$(echo $response | jq -r '.[].entitlements[].endDate' | tail -n1)"
echo "$ship_date"
echo "$support_end_date"
Further Reading:
Use the Dell API to Automate PC Warranty Information Lookup with PowerShell
https://techdirect.dell.com/portal/AboutAPIs.aspx
https://www.reddit.com/r/PowerShell/comments/cvu7z9/all_getdellwarrantyps1_users_should_read_this/