Set project logo using REST API

Hi,

I’m trying to set my projects’ logos using the REST API. This PowerShell call succeeds, but just resets the project’s logo to the default:

        Invoke-RestMethod -Method POST `
                -Uri http://$myOctopusServer/api/projects/$myProjectId/logo `
                -Headers @{ "X-Octopus-ApiKey" = $apikey } `
                -InFile $myFile `
                -ContentType "multipart/form-data"

I couldn’t find any more info or details about the /logo request in the API wiki: https://github.com/OctopusDeploy/OctopusDeploy-Api/wiki

What am I missing here?

Thanks for your help!
Martin.

Hi Martin,

Thanks for getting in touch!

You’re right, it’s pretty tricky to get multi-part HTTP posts happening in PowerShell. After some searching and trial and error, I found a way to do it!

I’ve created a Gist in GitHub that shows how to do it. The function it calls is based on this blog post by Mario Majčica.

Hope that helps!

Damo