I'd really love to use my newly learned API knowledge in scripts that would be immensely helpful. The main use would be for a policy to run a script that collects all kinds of various system information and saves that info in various text files and then those zip files are zipped up into a single .zip file. I got that part figured out. The part that's tripping me up is how to use the fileuploads in script form. If I run the following command manually in terminal, it works fine.
curl -sku USERNAME:PASSWORD https://jss.company.com/JSSResource/fileuploads/computers/id/100 -X POST -F name=@/PATH/TO/FILE
The problem is that in order to run this in a script, I have to input the username and password - a huge no-no. I figure there's gotta be a way to encrypt the password for the script. I've found lots of articles that explain how to run commands on my local admin Mac to create the encrypted PW. The problem is once I have that info, then what? If my apiuser's PW was Password01, there's no way I could run Password01 through the encryption to get 3h5gtv3k4htviue4gv and then use "3h5gtv3k4htviue4gv" in the password portion of the command because that obviously is not the password. How do I tell the server to accept this encrypted password?
Or is there another way of running api commands in scripts?