Projects.GetAll API and CLI returns 404 NotFound

Hi Octo,

Trying to scan for a literal in our Octo config and repository.Spaces.FindAll().ToList() works fine, spaceRepository.LibraryVariableSets.FindAll() works fine but spaceRepository.Projects.GetAll().ToList() results in OctopusResourceNotFoundException.

Tried the CLI as well and get the following:
image

The guys that own the platform suggested I try these forums. Any tips to get the API to work? I’m happy to take the option (if that exists) of going to the search box that checks all config for a particular server name. Even okay to export the whole DB to a text file and searching that if its a thing.

Hope you can help.

Hi @a.m,

Thank you for contacting Octopus Support.

Can you tell me where you expect to find the server name? Is it part of the Deployment Process or maybe it is a variable or perhaps a Deployment Target?

I’m not sure exporting every table in the Octopus SQL db to search as test will be faster than running the appropriate SQL query.

Let me know if me know if you can provide any additional details about what you are looking for at your earliest convenience.

Best Regards,
Donny Bell

Hi @donny.bell ,

Thank you for the reply.

I was just using server name as an example of the type of literal I’m searching for. It could show up in any artifact including variable values, variable names, project names, package names, release names, etc.

I’m sure I can do SQL queries if you have something to get me started. Guess the intent would be to scan everything but sensitive values.

Hi Andre,

I just did some quick testing here and I think there are a few things you could try here. The first thing that comes to mind is to try replacing .ToList() with .ToArray() when using the Octopus.Client. This let powershell create an array object with everything returned in the call. However, I think it’s worth taking a look at our repository of existing scripts on GitHub.

For example, FindVariableValueUsage.ps1 could be a good launching point for your own script if you’re looking for specific variables. The OctopusDeploy-Api repository is a great resource for example scripts and contains both Octopus.Client and REST scripts.

If you’re interested in searching all of Octopus for specific values used, then I think querying the DB may be the most accessible option.

Let me know if this helps or if you have any further questions at all.

Best regards,
Daniel

Hi Daniel,

Thank you for the advice.

I tried ToArray and get the same error. As you called out (and Donny recommended as well), I’m trying to get DB access to run some SQL queries.

The repository was useful for some initial ideas and examples while scripting up the searches. As indicated though they are failing and it looks like a data consistency issue to me. The repository also helped to understand the hierarchy of artifacts.

Hi Andre,

Thanks for the update. The fact that you’re seeing 404 is interesting and may hint towards a different issue (If you’re seeing it via the Octopus.Client). Seeing it via the CLI could just mean that it was simply unable to find the resource based on the input. I think for what you’re trying to achieve, SQL is still likely be the best option.

If you get stuck or have any further questions on this, please don’t hesitate to let me know.

Best regards,
Daniel

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.