From ProjectId to Version in C# using Octopus.Client

So I am trying to get the currently deployed version from a project ID. My latest attempt is this:

OctopusServerEndpoint endPoint = new OctopusServerEndpoint(server, apiKey);
OctopusClient client = new OctopusClient(endPoint);
var version = client.Get<Version>("~/api/projects/{projectId}/releases{/version}{?skip}");

But I keep getting this error: "The resource ‘releases’ was not found."
Even though I can look at it trough the web. Any ideas?
Any other good ways to get the currently deployed version from a project ID?

Hi,

Thanks for reaching out!

I’d recommend you to take a look at the Dashboard repository using repository.Dashboards.GetDashboard(). That’ll return the same info as the dashboard in the web UI.

It’ll have a collection of “Items” which are basically deployments. You can filter that collection by deployment status and project ID to get what you are looking for.

Hope that helps,
Dalmiro

Thanks! Found what I was looking for there :slight_smile:

//Simon