Posted on 04-19-2018 04:25 AM
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.
Solved! Go to Solution.
Posted on 05-10-2018 12:00 AM
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'
Posted on 04-19-2018 09:47 AM
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
Posted on 04-22-2018 05:32 AM
Thanks! @brysontyrrell I'd like to directly upload the package to distribution point.
Posted on 04-23-2018 04:10 AM
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)?
Posted on 04-23-2018 05:19 AM
@Yamashiro Uploading to the JCDS is not exposed via the jamf api currently, this is something folks using jss-importer are hoping for.
Posted on 04-23-2018 06:08 PM
Thanks! @bentoms
Is "jss-importer" the following things?
https://github.com/sheagcraig/JSSImporter
Posted on 05-10-2018 12:00 AM
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'
Posted on 03-16-2019 07:04 AM
@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.
Posted on 03-27-2019 01:34 AM
@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.
Posted on 03-28-2019 09:45 AM
@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 :)