Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ function Get-RsRestItemDataSource
$catalogItemsUri = [String]::Format($catalogItemsUri, $RsItem)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $catalogItemsUri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $catalogItemsUri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $catalogItemsUri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $catalogItemsUri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}

$item = ConvertFrom-Json $response.Content
Expand All @@ -99,11 +99,11 @@ function Get-RsRestItemDataSource

if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $dataSourcesUri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $dataSourcesUri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $dataSourcesUri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $dataSourcesUri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}

$itemWithDataSources = ConvertFrom-Json $response.Content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ function New-RsRestFolder

if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $foldersUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $foldersUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $foldersUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $foldersUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}

Write-Verbose "Folder $TargetFolderPath was created successfully!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ function Out-RsRestCatalogItem
$url = [string]::Format($catalogItemsByPathApi, $item)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,16 @@ function Out-RsRestCatalogItemId
if ($RsItemInfo.Type -ne 'MobileReport')
{
$itemId = $RsItemInfo.Id
$fileName = $RsItemInfo.Name + (Get-FileExtension -TypeName $RsItemInfo.Type)
$extension = "";
try {
$extension = (Get-FileExtension -TypeName $RsItemInfo.Type)
}
catch
{
Write-Warning "Unsupported Type: $($RsItemInfo.Type) Unable to export: $($RsItemInfo.Name)"
break;
}
$fileName = $RsItemInfo.Name + $extension
}
else
{
Expand Down Expand Up @@ -128,11 +137,11 @@ function Out-RsRestCatalogItemId
$url = [string]::Format($catalogItemContentApi, $itemId)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ function Out-RsRestFolderContent
$url = [string]::Format($catalogItemsByPathApiV1, $RsFolder)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}
}
catch
Expand All @@ -128,11 +128,11 @@ function Out-RsRestFolderContent
$url = [string]::Format($folderCatalogItemsApiV1, $folder.Id)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}
}
catch
Expand All @@ -148,11 +148,11 @@ function Out-RsRestFolderContent
$url = [string]::Format($folderCatalogItemsApiLatest, $RsFolder)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $url -Method Get -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ function Remove-RsRestCatalogItem

if ($Credential -ne $null)
{
Invoke-WebRequest -Uri $catalogItemsUri -Method Delete -WebSession $WebSession -Credential $Credential -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $catalogItemsUri -Method Delete -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing | Out-Null
}
else
{
Invoke-WebRequest -Uri $catalogItemsUri -Method Delete -WebSession $WebSession -UseDefaultCredentials -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $catalogItemsUri -Method Delete -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing | Out-Null
}

Write-Verbose "Catalog item $RsItem was deleted successfully!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ function Remove-RsRestFolder

if ($Credential -ne $null)
{
Invoke-WebRequest -Uri $foldersUri -Method Delete -WebSession $WebSession -Credential $Credential -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $foldersUri -Method Delete -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing -UseBasicParsing | Out-Null
}
else
{
Invoke-WebRequest -Uri $foldersUri -Method Delete -WebSession $WebSession -UseDefaultCredentials -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $foldersUri -Method Delete -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing -UseBasicParsing | Out-Null
}

Write-Verbose "Folder $RsFolder was deleted successfully!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ function Set-RsRestItemDataSource
Write-Verbose "Updating data sources for $($RsItem)..."
if ($Credential -ne $null)
{
Invoke-WebRequest -Uri $dataSourcesUri -Method $method -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -WebSession $WebSession -Credential $Credential -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $dataSourcesUri -Method $method -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing | Out-Null
}
else
{
Invoke-WebRequest -Uri $dataSourcesUri -Method $method -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -WebSession $WebSession -UseDefaultCredentials -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $dataSourcesUri -Method $method -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing | Out-Null
}
Write-Verbose "Data sources were updated successfully!"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ function Write-RsRestCatalogItem

if ($Credential -ne $null)
{
Invoke-WebRequest -Uri $catalogItemsUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $catalogItemsUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false -UseBasicParsing | Out-Null
}
else
{
Invoke-WebRequest -Uri $catalogItemsUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $catalogItemsUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false -UseBasicParsing | Out-Null
}

Write-Verbose "$EntirePath was uploaded to $RsFolder successfully!"
Expand All @@ -264,11 +264,11 @@ function Write-RsRestCatalogItem
$uri = [String]::Format($catalogItemsByPathApi, $itemPath)
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}

# parsing response to get Id
Expand All @@ -279,11 +279,11 @@ function Write-RsRestCatalogItem
$uri = [String]::Format($catalogItemsUpdateUri, $itemId)
if ($Credential -ne $null)
{
Invoke-WebRequest -Uri $uri -Method Put -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $uri -Method Put -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false -UseBasicParsing | Out-Null
}
else
{
Invoke-WebRequest -Uri $uri -Method Put -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false | Out-Null
Invoke-WebRequest -Uri $uri -Method Put -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false -UseBasicParsing | Out-Null
}
Write-Verbose "$EntirePath was uploaded to $RsFolder successfully!"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ function Write-RsRestFolderContent
# Try to get folder info
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false -UseBasicParsing
}
else
{
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false
$response = Invoke-WebRequest -Uri $uri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false -UseBasicParsing
}

# parsing response to get folder name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ function New-RsRestSession
Write-Verbose "Making call to $meUri to create a session..."
if ($Credential)
{
$result = Invoke-WebRequest -Uri $meUri -Credential $Credential -SessionVariable mySession -Verbose:$false -ErrorAction Stop
$result = Invoke-WebRequest -Uri $meUri -Credential $Credential -SessionVariable mySession -Verbose:$false -ErrorAction Stop -UseBasicParsing
}
else
{
$result = Invoke-WebRequest -Uri $meUri -UseDefaultCredentials -SessionVariable mySession -Verbose:$false -ErrorAction Stop
$result = Invoke-WebRequest -Uri $meUri -UseDefaultCredentials -SessionVariable mySession -Verbose:$false -ErrorAction Stop -UseBasicParsing
}

if ($result.StatusCode -ne 200)
Expand Down