Query internal NuGet feed via Octopus.Client

My company is on version 3.12.7.

Is it possible to use the Octopus.Client API to query our internal NuGet feeds to get a list of available package versions?

If so, how do I do that?

Thanks!

Hi Tyson,

Thanks for getting in touch! I’m sorry for the late response. Would you be able to clarify which NuGet feed? Octopus.Client will be able to list packages in your built-in feed but it will not be able to do so for any non-Octopus external feed.

I quickly put together a PowerShell script to do this with the Octopus.Client.

Add-Type -Path 'Octopus.Client.dll'

$apikey = 'API-' # Get this from your profile
$octopusURI = 'http://localhost/' # Your server address

$endpoint = new-object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey 
$repository = new-object Octopus.Client.OctopusRepository $endpoint


$packages = $repository.BuiltInPackageRepository.ListPackages($anything).items

foreach ($x in $packages.ID) {
    $packageID + $x
}
$packagesID

This will output the following: packages-VersionTest.1.2.3

I put this together pretty quick so it may not be exactly what you need but feel free to use it to get you started.

Please let me know if you have any further questions. :slight_smile:

Best regards,
Daniel

1 Like

Thanks for the reply, Daniel.

Unfortunately, I am looking to access a non-Octo, external feed. I was able to solve for that using nuget’s API.

Appreciate the help,

Tyson

Hi Tyson,

No worries at all, we are always happy to help however we can. I’m glad to hear solved your issue none the less. :slight_smile:

Please feel free to get in touch at any time.

Best regards,
Daniel