We have >30 projects in our Octopus and we are building tools around it, and need to retrieve parts of particular projects.
Component Versions:
Octopus.Client (4.30.8)
Octopus Server (v2018.1.2)
Existing code (no longer works)
public ProjectResource GetProject(string projectId)
{
return _repo.Projects.FindOne(x => x.Id == projectId);
}
Updated code (works, but is clunky given we know the project id)
public ProjectResource GetProject(string projectId)
{
var projects = _repo.Projects.GetAll();
foreach (var p in projects)
{
if (p.Id == projectId) return p;
}
return null;
}
When I look in Fiddler I notice that the 2nd request doesn’t include the Port number for the Octopus server.
GET http://octopusserver:8010/api/projects HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Octopus-ApiKey:
User-Agent: OctopusClient-dotnet/4.30.8
x-ms-request-root-id: oA/WLpkdmYo=
x-ms-request-id: |oA/WLpkdmYo=.8fabe765_84.
Request-Id: |oA/WLpkdmYo=.8fabe765_84.
Host: octopusserver:8010
List of Projects returned (only 30)
Response : 200
GET http://octopusserver/api/projects?skip=30&take=30 HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Octopus-ApiKey:
User-Agent: OctopusClient-dotnet/4.30.8
Host: octopusserver
x-ms-request-root-id: oA/WLpkdmYo=
x-ms-request-id: |oA/WLpkdmYo=.8fabe765_101.
Request-Id: |oA/WLpkdmYo=.8fabe765_101.
Response : 302 (Because port is wrong) back to the server on port octopusserver:8010