DexG83
Enthusiast
Enthusiast

Upload ISO to Content Library using curl

Hello Community,

I am trying to automate an iso upload to vcenter content library.

The iso is stored on my ssh host and I try to build a curl command to upload it to content library.

So the first thing I have done is to create a new content libray item, got the ID and generated a Item Update Session.

With that I want to use "Add Item Updatesession File" to upload the file.

curl -X POST -H "vmware-api-session-id: b00db39f948d13ea1e59b4d6fce56389" -H "Content-Type: application/json" -d '{"file_spec":{"checksum_info":{"algorithm":"SHA1","checksum":"string"},"name":"string","size":0,"source_endpoint":{"ssl_certificate_thumbprint":"string","uri":"string"},"source_type":"NONE"}}' https://{api_host}/rest/com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=add

Can anybody tell me where to define the local file path of my iso?

~/isos/test.iso

 Thanks in advance,

Dex

Labels (2)
0 Kudos
1 Reply
eoinbyrne
Expert
Expert

Looks like you can use -F to specify the file

 

From here - https://stackoverflow.com/questions/12667797/using-curl-to-upload-post-data-with-files

eoinbyrne_0-1649697431692.png

There's also an example further down the list which uses the -X as you're doing with -F as a trailer.

 

-HTH

0 Kudos