Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

How can I upload .dmg file via the JSS API?

I'd like to upload .dmg file to the cloud distribution point via the JSS API.

I tried uploading the.dmg file by executing the following API.

curl -fku username:password https://mydomain/JSSResource/packages/id/0 -T test-dmg.xml -X POST
curl -fku username:password https://mydomain/JSSResource/fileuploads/packages/id/68 -F "test.dmg=@test.dmg" -X POST

And then, When I checked the package in JSS Settings > Computer Management > Packages,
Uploading is not completed with the status "Pending" all the time.

How can I upload .dmg file via the JSS API?
I would like some information.

Like Comment
Order by:
JAMFBadge
SOLVED Posted: by brysontyrrell

Hi @Yamashiro

“Packages” aren’t a supported resource for the /fileuploads endpoint.

From the API docs:
“Attachments can be uploaded by specifying computers, mobiledevices, enrollmentprofiles, printers, or peripherals as the resource.”

You need to directly upload the package to your distribution point(s) and then creat the package object in the database.

You could also look into the python-jss which provides methods for handling that.

https://github.com/sheagcraig/python-jss

Like
SOLVED Posted: by Yamashiro

Thanks! @brysontyrrell I'd like to directly upload the package to distribution point.

Like
SOLVED Posted: by Yamashiro

I use the cloud distribution point (Jamf Cloud Distribution Service), but I do not know how to upload the package directly with CUI.
I confirmed the contents of "python-jss", but I could not find a description of uploading directly with CUI to the cloud distribution point (Jamf Cloud Distribution Service) .

Would you please let me know if you have a way to upload the package directly with CUI to the cloud distribution point (Jamf Cloud Distribution Service)?

Like
SOLVED Posted: by bentoms

@Yamashiro Uploading to the JCDS is not exposed via the jamf api currently, this is something folks using jss-importer are hoping for.

Like
SOLVED Posted: by Yamashiro

Thanks! @bentoms Is "jss-importer" the following things?
https://github.com/sheagcraig/JSSImporter

Like
SOLVED Posted: by Yamashiro

I was able to upload a package to the cloud distribution point(Jamf Cloud Distribution Service) by doing the following.

curl -u username:password -X POST https://mydomain/dbfileupload -H 'DESTINATION: 0' -H 'OBJECT_ID: -1' -H 'FILE_TYPE: 0' -H 'FILE_NAME: test.dmg' -T '/Users/username/test.dmg'
Like
SOLVED Posted: by grahamrpugh

@Yamashiro Does this work consistently for you? I've been trying it out on a Cloud beta instance, and although the command appears to successfully create a new package object, the package itself remains as Pending Availability forever.

Like
SOLVED Posted: by honestpuck

@grahamrpugh I found that it worked fine for me. One thing I noticed with your example was you had a space in the package name. None of mine had spaces, I map those to underscore.

Now for a way to set such things as the Category :) I may have to grab the package ID from the returned HTML and then use python-jss to change the package info.

Like
SOLVED Posted: by grahamrpugh

@honestpuck It started working for me too with a bit of work on the command. See gist link - jcds_upload.py

And JSSImporter does exactly what you state; grabs the package ID and uses python-jss to populate the package info. So it's definitely possible.

The problem here is that the dbfileupload method is undocumented and deprecated (it was there for JDS) - it's the method where the package file is first uploaded into the database and then on to the distribution points. @mosen has done some excellent work to try and upload the file using the same method as the GUI, and it is somewhat working in JSSImporter 1.0.2b2. But again, it's an undocumented method - we would all really like Jamf to give us a proper API method to use for all JDS types :)

Like

Jamf would like feedback on User Enrollment and General Settings within your Pro instance!