So I've been working on a powershell script to export all of my workflows out of one vCO server and then import them back in to another
I've got the export working great!
That said, can't figure out the code to import back in - wondering if anyone knows how to do so....
$body = "file=$(get-content C:\workflows\ConfigureNTP.zip -raw)"
Invoke-RestMethod -URi $categoryuri -Method POST -body $body -Credential $cred
-ContentType "application/zip" -Headers @{"Content-Disposition"="form-data";"name"="configureNTP";"filename"="configureNTP.zip";}
Keep getting a 415 status - server refused this request because the request entity is in a format not supported by the requested resource for the requested method...
I have no clue - but I'm trying Just wondering if anyone has accomplished this before with the Invoke-RestMethod cmdlet
This one worked on my PC
See attached script & sample workflow
.\import-workflow.ps1 -vcoHost xx.xx.xx.xx -user vcoadmin-pass vcoadmin -categoryId 8a978cc84509e09c01450a18f9bc0013 -file C:\Temp\Content_byte1.workflow
and/or curl syntax would do? And/or vCO javascript syntax
And sample request should look like so
https://10.23.12.72:8281/vco/api/workflows?overwrite=true
== Headers ==
Authorization Basic YWRtaW5pc3RyYXRvcjp2bXdAcmUx
Accept application/zip
Accept-Encoding gzip,deflate,sdch
====Body ====
------WebKitFormBoundaryYz07MRfkf3U6aWBB
Content-Disposition: form-data; name="categoryId"
8a978cc84509e09c01450a18f9bc0013
------WebKitFormBoundaryYz07MRfkf3U6aWBB
Content-Disposition: form-data; name="file"; filename="Content_byte1.workflow"
Content-Type: application/octet-stream
binary file content
------WebKitFormBoundaryYz07MRfkf3U6aWBB--
You are a savior!!!!!
I had to change line 71 to $file.FullName instead of $file.Name since I wasn't running under the same directory as the workflow exports - but all in all - works perfectly!!!!
$b = [System.IO.File]::ReadAllBytes($file.FullName)
You are awesome! Thanks so much! Now I just need to learn what you did
Thanks so much! I'm working on a couple of scripts for migration, in which I'll probably end up posting on my blog - none the less I'll post back here and give you the credit due!!!
Thanks again!
NOTE: there were a couple minor errors in the export script that I have resolved.
I have added both the import-workflow.ps1 (with updated line 71) and export-workflow.ps1 to my github repository here: http://bit.ly/vroClientScripts