I am looking for a way to pull a report via the JSS API to show all the Policies that are associated with a specific script. Looking through the API, I don't see any simple way of finding this information.
I have been able to accomplish this via a MySQL query similar to this:
SELECT
scripts.file_name,
scripts.script_id,
policies.name,
policies.policy_id
FROM policy_scripts
INNER JOIN scripts
ON scripts.script_id = policy_scripts.script_id
INNER JOIN policies
ON policies.policy_id = policy_scripts.policy_id
WHERE scripts.file_name = "Super Awesome Script";
This query would return the the data in the following format:
file_name script_id name policy_id
Super Awesome Script 165 Super Awesome Policy 1 1645
Super Awesome Script 165 Super Awesome Policy 2 2314
Super Awesome Script 165 Super Awesome Policy 3 2356
Is there anyway to achieve the same thing via the API that I am missing?