-
1. Re: Problem with uploading multipart content Workbook PS
Glen Robinson Feb 28, 2017 1:21 PM (in response to PEter Mueller)Hi Peter
I had a few issues with this as well using PS.
Few things that I found were.
Ensure that the $strBody has the right formatting espicially around the carriage returns.
The example on the REST API page shows the number of blank lines between the sections. These need to be the same as the example (if I remember correctly)
Also, the boundary string needs to be declared in the header (See below)
boundary-string A string of characters that is guaranteed to be unique within the body of the request, and that is used to delimit sections of the request body. This value must be declared as a header that has this format: Content-type: multipart/mixed; boundary=boundary-string
The other issue I found was that posting using Invoke-RestMethod worked fine with publishing XML content (TWB files), but failed when publishing Extracts or TWBX.
So, I used the following instead
$wc = New-Object System.Net.WebClient
$wc.Headers.Add('X-Tableau-Auth',$headers.Values[0])
$wc.Headers.Add('ContentLength', $request_body.Length)
$wc.Headers.Add('Content-Type', 'multipart/mixed; boundary=6691a87289ac461bab2c945741f136e6')
$response = $wc.UploadString($url ,'POST', $request_body)
Hope that that this helps
All the best
Glen
-
2. Re: Problem with uploading multipart content Workbook PS
Hugh NguyenMar 10, 2017 4:40 PM (in response to PEter Mueller)
The vizportal logs may provide some insight as to what's going on. If not, you can enable debug mode and reproduce the issue.