Rimo3 API - Import an Application

Step-by-step guide to importing an application using the Rimo3 API.

Import a simple MSI Application

Example 1 - Upload

In this example, you’ll use the API to upload, onboard, and test 7Zip.

The specific API endpoint in use is:

/api/v2/application-packages/upload

Only Only MSI, App-V, MSIX or App Volumes can be automatically imported with this API.

First, locally download the MSI and compress it into a zip file.

Once complete, call the application upload API while providing the file path of the created zip file.

The script below references variables previously created in the following article.

While this is a simple activity, there is a challenge. You must convert the file path to a file stream, hence the need for multiple lines of PowerShell. 

#TODO: Update these two
$filePath = "C:\Downloads\7z2301-x64.zip"
$uri = "https://rimo3cloud.com/api/v2/application-packages/upload"

Add-Type -AssemblyName 'System.Net.Http'

$client = New-Object System.Net.Http.HttpClient
$client.DefaultRequestHeaders.Authorization = New-Object System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", $token)
$fileName = [System.IO.Path]::GetFileName($filePath)
$fileStream = [System.IO.File]::OpenRead($filePath)
$fileContent = New-Object System.Net.Http.StreamContent($fileStream)
$content = New-Object System.Net.Http.MultipartFormDataContent
$content.Add($fileContent, $fieldName, $fileName)


$result = $client.PostAsync($uri, $content).Result
Write-Host $result.ToString() 

After completing, you’ll receive feedback on the success of the upload, which also includes a Sequence ID to track the upload progress.

Example 2 - Upload with Link

In this example, you’ll use the API to upload, onboard, and test 7Zip.

The specific API endpoint in use is:

/api/v2/application-packages/upload/link

Only Only MSI, App-V, MSIX or App Volumes can be automatically imported with this API.

First, locally download the MSI and compress it into a zip file.

Create a downloadable link for the zip file, e.g. https://xxx-my.sharepoint.com/:u:/g/personal/xx_rimo3_com/EfZ_yGhYEzZBpHGHsNQqUd0BM5sUHIgAq_vC2vBhy2-jlg?download=1.

The link must be a direct download link or the import will fail.  

The script below references variables previously created in the following article.

$UploadLinkBody = @{
  "fileLink" = "https://xxx-my.sharepoint.com/:u:/g/personal/xxx_rimo3_com/EfZ_yGhYEzZBpHGHsNQqUd0BM5sUHIgAq_vC2vBhy2-jlg?download=1"
  "fileName" = "7z2301-x64-JamesTest.zip"
  "progressStep" = 2
}

$UploadlinkJSON = $UploadLinkBody | ConvertTo-Json

Possible values are: 

  • 0 = Import
  • 1 = Import + Discovery
  • 2 = Import + Discovery + Baseline
  • 3 = Import + Discovery + Baseline + Test
$UploadLinkHeader = @{
    Authorization = "Bearer $token"
    "Content-Type" = "application/json"
}

$UploadLinkParameters = @{
    Method = "POST"
    Uri = "$($server_uri)/api/v2/application-packages/upload/link"
    Headers = $UploadLinkHeader
    Body = $UploadlinkJSON
}

# Use splatting to pass the parameters correctly
$result = Invoke-RestMethod @UploadLinkParameters
Write-Host ($result | ConvertTo-Json)

The sequence identifier of the import process will be returned. 

Import a Custom Application

For the above methods the metadata will be derived from the application package. However there are scenarios where you may want to create your own metadata or import scripted installers. 

In this example we will import a customised application using the following API endpoint:

/api/v2/application-packages/upload/manual/link

First, locally download the MSI and compress it into a zip file.

Create a downloadable link for the zip file, e.g. https://xxx-my.sharepoint.com/:u:/g/personal/xx_rimo3_com/EfZ_yGhYEzZBpHGHsNQqUd0BM5sUHIgAq_vC2vBhy2-jlg?download=1.

The link must be a direct download link or the import will fail.  

The script below references variables previously created in the following article.

#Manual Custom Link
$UploadLinkBody = @{
  "fileLink" = "https://xxx-my.sharepoint.com/:u:/g/personal/xxx_rimo3_com/EfZ_yGhYEzZBpHGHsNQqUd0BM5sUHIgAq_vC2vBhy2-jlg?download=1"
  "fileName" = "7z2301-x64-JamesTest.zip"
  "displayName" = "7zip v2301 demo"
  "comment" = "This is a demo"
  "publisher" = "Igor Pavlov"
  "name" = "7ZIP"
  "version" = "23.01"
  "installCommand" = 'msiexec /i "7z2301-x64.msi" /qn'
  "uninstallCommand" = "msiexec /x {23170f69-40c1-2702-2301-000001000000} /qn"
  "progressStep"= 2
}

$UploadlinkJSON = $UploadLinkBody | ConvertTo-Json

$UploadLinkHeader = @{
    Authorization = "Bearer $token"
    "Content-Type" = "application/json"
}

$UploadLinkParameters = @{
    Method = "POST"
    Uri = "$($server_uri)/api/v2/application-packages/upload/manual/link"
    Headers = $UploadLinkHeader
    Body = $UploadlinkJSON
}

# Use splatting to pass the parameters correctly
$result = Invoke-RestMethod @UploadLinkParameters
Write-Host ($result | ConvertTo-Json) 

The sequence identifier of the import process will be returned. 

Back to top.

 

Something missing from this page or want to give feedback?