Cannot Update Project Logo Via API

Hello,

Is it possible to set a projects logo via the web api? I am trying to swap color coded logo to show the status of a blue green deployment. I have tried a couple approaches and none seem to be working. Here are some code snippets that I have tried (note : I am using octoposh in conjunction)

function Set-OctopusProjectLogo{
    Param([String] $projectName, [String] $imagePath)

    $project = Get-OctopusProject -ProjectName $projectName
    $conn = Get-OctopusConnectionInfo
    $key = $conn.OctopusAPIKey
    $server = $conn.OctopusURL
    $endpoint = "$server/api/projects/$($project.Id)/logo?apiKey=$key"
    
    $response = Invoke-RestMethod `
	                -Uri $endpoint `
	                -Method POST `
	                -InFile $imagePath `
	                -ContentType 'multipart/form-data'
	$response
}

I know InFile has had some problems in the past, so I also tried this :

function Set-OctopusProjectLogo{
    Param([String] $projectName, [String] $imagePath)

    $project = Get-OctopusProject -ProjectName $projectName
    $conn = Get-OctopusConnectionInfo
    $key = $conn.OctopusAPIKey
    $server = $conn.OctopusURL
    $endpoint = "$server/api/projects/$($project.Id)/logo?apiKey=$key"
    $contentType = .\mime.ps1 -file $imagePath

    $fileName = Split-Path $imagePath -leaf
    $fileBin = [System.IO.File]::ReadAllBytes($imagePath)

	$boundary = [guid]::NewGuid().ToString()
	$enc = [System.Text.Encoding]::GetEncoding("iso-8859-1")

    $template = Get-DispositionTemplate

    $body = $template -f $boundary, $fileName, $contentType, $enc.GetString($fileBin)
    
    $response = Invoke-WebRequest `
	                -Uri $endpoint `
	                -Method POST `
	                -Body $body `
	                -ContentType 'multipart/form-data; boundary=$boundary'
	$response
}

function Get-DispositionTemplate{
#note : white space and line breaks are important in the string below

@'
--{0}
Content-Disposition: form-data; name="fileData"; filename="{1}"
Content-Type: {2}
 
{3}
--{0}--
 
'@

}

And neither work. Is this even possible? Or am I just spinning my wheels.

Sorry, didn’t see this

http://help.octopusdeploy.com/discussions/questions/7983-set-project-logo-using-rest-api

Please Close

For future reference - The script has been added to our repo of examples: