Purpose: Retrieve the available proposed solutions for an optimization and use their IDs for details or export.
Prerequisites: intelliDivide with the Connect interface, IntelliDivideClient configured, and a completed optimization. You can check the status first.
Code
var optimizationId = Guid.Parse("a1b2c3d4-e5f6-7890-abcd-ef1234567890");
var solutions = await client.GetSolutions(optimizationId);
if (solutions is null)
{
Console.WriteLine("Keine Lösungen zurückgegeben.");
}
else
{
foreach (var solution in solutions)
{
Console.WriteLine($"{solution.Id}: {solution.Name} ({solution.Characteristic})");
}
}
GET https://connect.homag.cloud/api/intelliDivide/optimizations/a1b2c3d4-e5f6-7890-abcd-ef1234567890/solutions
Authorization: Basic <base64(SubscriptionId:Berechtigungsschlüssel)>
Accept: application/json
200 OK (excerpt):
[
{
"id": "c0a23a97-2577-49ce-a888-2ec87751c672",
"name": "Lösung 1",
"characteristic": "LowestMaterialCosts"
}
]
The id in the list is the solution ID, not the optimizationId from the URL. characteristic describes the main characteristic of a proposal, for example the lowest material costs.
Contracts used
| Contract | Usage |
|---|---|
Solution |
Output: solution with ID, name, and overview. |
SolutionCharacteristic |
Output: characteristic of the proposed solution. |
Common errors
| REST status | What to check |
|---|---|
404 Not Found |
No solutions are available for this optimization. Check the optimization ID and status. |
401 Unauthorized |
Check the SubscriptionId and authorization key. |
