Uploading Policy Icon via API

SotS
New Contributor

Hello,
I am currently in the process of making a C# based service that takes packages out of a Workflow Management System and creats JAMF packages and policies accordingly. One of the issues ive ran into is that a requrement is to give each policy a PNG picture in Self Service so they can be identified.

I have the picture and policies are being successfully created as well. Though I have no clue how I am able to upload the pictures for the policies as well and set them as their Self Service Icons.

I have browsed the documentation for the Classic API but have found no resource that directly maps to an Icon Model or something alike.

1 REPLY 1

mm2270
Legendary Contributor III

This post from me from a few years back may get you on the right track - https://www.jamf.com/jamf-nation/discussions/23231/mass-icon-upload#responseChild140581

In that post, I have a script that I whipped up to upload Self Service icons en-masse, but the general principle can be used for uploading a single icon to an existing policy. I'm not completely certain, but from what I recall, the policy has to be created first, then the icon can be uploaded to it.
In case it helps, this is the relevant line from the script in the above post:

/usr/bin/curl -sfku "${APIUSER}:${APIPASS}" "${JSSURL}/JSSResource/fileuploads/policies/id/$NEWPOLICYID" -F name=@"${ICONFILE}" -X POST

Hope that helps. If you run into an issues, feel free to post back so it can be worked through.