Commit eea03e66 authored by Tim Rice's avatar Tim Rice
Browse files

Add new file

parent 695311b5
#!/bin/bash
# Fetch the token
./get_token
TOKEN=$(<.token)
# Check if both vendor ID and letter grade are provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <vendor_id> <lettergrade>"
exit 1
fi
id=$1
letterscore=$(echo "$2" | tr '[:lower:]' '[:upper:]')
#Map letter grades to vendor score IDs. Each dropdown value in the vendorRating field has a unique id
declare -A score_map=(
["A"]="00c83b87-cff1-4e81-9c19-a66984ec5077"
["B"]="2dde940a-3b05-4f15-b31e-81e4ecba617c"
["C"]="eefbb260-e2bc-4be5-b3d2-1ef0e9902d1c"
["D"]="ca270274-3085-432a-919b-9f101881c12b"
["F"]="3defc5cc-3afb-424c-a95b-76071cc515bf"
)
vendorscoreid=${score_map[$letterscore]}
if [ -z "$vendorscoreid" ]; then
echo "Invalid letter grade: $letterscore"
exit 1
fi
#updating the "Vendor Score" attribute for the vendor
curl -s --request PUT \
--url "https://app.onetrust.com/api/inventory/v2/inventories/vendors/$id" \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header "authorization: Bearer $TOKEN" \
--data "{
\"vendorRating\": [
{
\"id\": \"$vendorscoreid\",
\"value\": \"$letterscore\",
\"valueKey\": \"VendorsVendorRating$letterscore\"
}
]
}" >/dev/null
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment