Happy 8th birthday to the Maveryx Community! Take a walk down memory lane in our birthday blog, and don't miss out on the awesome birthday present that all Maveryx Community members get to take advantage of!
and various other places to build our solution(in PowerShell). Currently we were able to authenticate, get migratable objects from one server, download the workflow as .yxzp package. However when we tried to POST the package to production we were facing troubles.
API Body Code attached below:
$boundary = [System.Guid]::NewGuid().ToString() $file = "<file full path>\file.yxzp" #change it $name = "Success_File" $owner = "<valid mail id>" #change it $validate = "True" $isPublic = "True" $sourceId = "<Source ID of the workflow>" #change it $workerTag = "" $canDownload = "True" $comments = ""
While I upgraded my server version to a version that uses the oauth 2.0 endpoints, you should be able to successfully create the post request using cURL. Note that my example uses oauth 2.0 authentication and not 1.0, so you will have to make changes around that, but the body should get you on the right path. I believe this is now installed with Windows by default, but I'd highly recommend using cURL over invoke-restmethod in this case. I was never able to correctly format the request using invoke-restmethod. Here's the snippet from the article linked above:
Thanks @igallion . Both Invoke-restmethod and invoke-webrequest are so painful to format when it comes to "formData"
For anyone who is working on powershell API calls to Alteryx Server - the above code works and the cleanest way to call! just replace .\curl.exe to path where curl is installed ( C:\Windows\System32\curl.exe) in my case.
Heard that post powershell 6, curl is not shipped with windows. But I would say it is worth to install it :-)