Skip to main content
Solved

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


Forum|alt.badge.img+6

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.

Best answer 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'
View original
Did this topic help you find an answer to your question?

9 replies

BrysonTyrrell
Forum|alt.badge.img+19
  • Valued Contributor
  • 85 replies
  • April 19, 2018

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 17 replies
  • April 22, 2018

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 17 replies
  • April 23, 2018

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)?


bentoms
Forum|alt.badge.img+35
  • Legendary Contributor
  • 4331 replies
  • April 23, 2018

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 17 replies
  • April 24, 2018

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


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 17 replies
  • Answer
  • May 10, 2018

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'

Forum|alt.badge.img+17
  • Valued Contributor
  • 187 replies
  • March 16, 2019

@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.


honestpuck
Forum|alt.badge.img+11
  • Contributor
  • 48 replies
  • March 27, 2019

@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.


Forum|alt.badge.img+17
  • Valued Contributor
  • 187 replies
  • March 28, 2019

@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 :)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings