Can we add packages to the JSS thru the API?

John_Sutcliffe
New Contributor III
New Contributor III

Can we add packages to the JSS thru the API?

4 REPLIES 4

waderobson
New Contributor III

there has got to be a way to stub in packages. There is no documentation on how to do this however. I've tried curl -k -v -u user:password https:/jss.host.com:8443/JSSResource/packages/id/{somenumber} -T Untitled.xml -X POST

heres my xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<packages>
<package>

<name>
test.pkg
</name>
</package>
</packages>

doesn't work. Tested with v9.12

Banks
Contributor

To address the OP's question, the answer is not exactly - you can POST metadata about the pkg(filename, category, name, etc.) but the JSS instance doesn't necessarily directly interact with the file distribution share.

Mr. Robson, you should be getting hints in some sort of a valid response in your verbose output from curl, here's valid XML I just used:

<?xml version="1.0" encoding="UTF-8"?><package><id>1</id><name>VLC-2.0.8.pkg</name><category>VLC</category><filename>VLC-2.0.8.pkg</filename><info/><notes/><priority>10</priority><reboot_required>false</reboot_required><fill_user_template>false</fill_user_template><fill_existing_users>false</fill_existing_users><boot_volume_required>false</boot_volume_required><allow_uninstalled>false</allow_uninstalled><os_requirements/><required_processor>None</required_processor><switch_with_package>Do Not Install</switch_with_package><install_if_reported_available>false</install_if_reported_available><reinstall_option>Do Not Reinstall</reinstall_option><triggering_files/><send_notification>false</send_notification></package>

POST'ing a category at an unused id with valid XML works just the same.
Allister

waderobson
New Contributor III

Ok working off @Banks's response I was able to get this to work

curl -k -v -u user:password https:/jss.host.com:8443/JSSResource/packages -T xmlFile.xml -X POST

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<package>
<name>
test.pkg
</name>
<filename>test.pkg</filename>
</package>

You could add the category key etc,etc, but this seems to add the reference to the file. You would need to add the file to your distribution point with something else. The api will not work for that, should be easy to do though.

Mithrandir
New Contributor III

Using the example herein, I was able to auth to my cloud instance, putting a file there. Utilizing a web browser, I navigated to the URL, which just showed me a wall of text, but the text was all my package names! Going back to terminal, and using the following syntax:

curl -L -o [Numeric Value assigned by JSS]Package_Name.pkg --user apiuser:password https:/your.jss.instance:443/JSSResource/packages/22test_package.pkg -X POST

It downloaded without issue!