ProjectApi
| Method | Description |
|---|---|
| CloseProjectAsync | Closes the project and releases resources in the service. |
| CreateEmptyProjectAsync | Creates a new empty IdeaCon project with no connections. |
| DownloadProjectAsync | Downloads the current IdeaCon project from the service, including all changes made by previous API calls. |
| GetActiveProjectsAsync | Gets the list of projects in the service that were opened by the client connected via M:IdeaStatiCa.ConnectionRestApi.Controllers.ClientController.ConnectClient. |
| GetProjectDataAsync | Get data of the project. |
| ImportIOMAsync | Create the IDEA Connection project from IOM provided in xml format. The parameter 'containerXmlFile' passed in HTTP body represents : IdeaRS.OpenModel.OpenModelContainer which is serialized to XML string by IdeaRS.OpenModel.Tools.OpenModelContainerToXml |
| OpenProjectAsync | Opens an IdeaCon project from the provided file. |
| UpdateFromIOMAsync | Update the IDEA Connection project by IdeaRS.OpenModel.OpenModelContainer (model and results). IOM is passed in the body of the request as the xml string. IdeaRS.OpenModel.Tools.OpenModelContainerToXml should be used to generate the valid xml string |
| UpdateProjectDataAsync | Updates ConProjectData of project. |
CloseProjectAsync
void CloseProjectAsync (Guid projectId)
Closes the project and releases resources in the service.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the project to be closed. |
Return type
void (empty response body)
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class CloseProjectAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// Open the project and get its id
var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
Guid projectId = projData.ProjectId;
// (Required) Select parameters
try
{
// Closes the project and releases resources in the service.
conClient.Project.CloseProjectAsync(projectId);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.CloseProjectAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Closes an open project in the service and releases its resources.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task CloseProject(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple cleat connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
Guid projectId = conClient.ActiveProjectId;
Console.WriteLine("Project opened with Id: " + projectId);
//Close the project to release resources in the service.
//Any unsaved changes are lost, so save the project first if required.
await conClient.Project.CloseProjectAsync(projectId);
Console.WriteLine("Project " + projectId + " was closed.");
//No project is active on the client anymore.
Console.WriteLine("Active project Id after closing: " + conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
GET /api/5/projects/{projectId}/close
Using the CloseProjectWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Closes the project and releases resources in the service.
conClient.Project.CloseProjectWithHttpInfo(projectId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.CloseProjectWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 204 | No Content | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CreateEmptyProjectAsync
ConProject CreateEmptyProjectAsync (ConProjectData conProjectData = null)
Creates a new empty IdeaCon project with no connections.
Extension Methods
This operation has an avaliable client extension method. Refer to code samples for extension method usage.
CreateEmptyProject(...)
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| conProjectData | ConProjectData | Optional project metadata. The CountryCode field determines the design code and must be one of ECEN, American, Canada, Australia, RUS, CHN, India or HKG; any other value of the enum is refused with 422. Defaults to ECEN when omitted or set to None. | [optional] |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class CreateEmptyProjectAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
var conProjectData = new ConProjectData(); // ConProjectData | Optional project metadata. The CountryCode field determines the design code and must be one of ECEN, American, Canada, Australia, RUS, CHN, India or HKG; any other value of the enum is refused with 422. Defaults to ECEN when omitted or set to None. (optional)
try
{
// Creates a new empty IdeaCon project with no connections.
ConProject result = await conClient.Project.CreateEmptyProjectAsync(conProjectData);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.CreateEmptyProjectAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaRS.OpenModel;
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Creates a new empty connection project with a chosen design code.
/// The empty project can then be populated using other API calls (e.g. members, operations or templates).
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task CreateEmptyProject(IConnectionApiClient conClient)
{
//Create an empty project for the given design code and name.
ConProject project = await conClient.Project.CreateProjectAsync(new ConProjectData { CountryCode = CountryCode.ECEN, Name = "My empty project" });
Console.WriteLine("Empty project created with Id: " + project.ProjectId);
Console.WriteLine("Project name: " + project.ProjectInfo.Name);
Console.WriteLine("Design code: " + project.ProjectInfo.CountryCode);
Console.WriteLine("Number of connections: " + project.Connections.Count);
string exampleFolder = GetExampleFolderPathOnDesktop("CreateEmptyProject");
string saveFilePath = Path.Combine(exampleFolder, "empty-project.ideaCon");
//Save the empty project.
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
Console.WriteLine("Project saved to: " + saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
POST /api/5/projects
Using the CreateEmptyProjectWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Creates a new empty IdeaCon project with no connections.
ApiResponse<ConProject> response = conClient.Project.CreateEmptyProjectWithHttpInfo(conProjectData);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.CreateEmptyProjectWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json-patch+json, application/json, text/json, application/*+json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 422 | Unprocessable Content | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DownloadProjectAsync
void DownloadProjectAsync (Guid projectId)
Downloads the current IdeaCon project from the service, including all changes made by previous API calls.
Extension Methods
This operation has an avaliable client extension method. Refer to code samples for extension method usage.
SaveProject(...)
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the opened project in the ConnectionRestApi service. |
Return type
void (empty response body)
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class DownloadProjectAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// Open the project and get its id
var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
Guid projectId = projData.ProjectId;
// (Required) Select parameters
try
{
// Downloads the current IdeaCon project from the service, including all changes made by previous API calls.
conClient.Project.DownloadProjectAsync(projectId);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.DownloadProjectAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Downloads the current project from the service and saves it as an .ideaCon file.
/// The downloaded file includes all changes made by previous API calls.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task DownloadProject(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple cleat connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
string exampleFolder = GetExampleFolderPathOnDesktop("DownloadProject");
string saveFilePath = Path.Combine(exampleFolder, "downloaded-project.ideaCon");
//SaveProjectAsync calls the download-project endpoint and writes the received data to the file.
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
Console.WriteLine("Project downloaded to: " + saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
GET /api/5/projects/{projectId}/download
Using the DownloadProjectWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Downloads the current IdeaCon project from the service, including all changes made by previous API calls.
conClient.Project.DownloadProjectWithHttpInfo(projectId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.DownloadProjectWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: application/octet-stream
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetActiveProjectsAsync
List<ConProject> GetActiveProjectsAsync ()
Gets the list of projects in the service that were opened by the client connected via M:IdeaStatiCa.ConnectionRestApi.Controllers.ClientController.ConnectClient.
Parameters
This endpoint does not need any parameter.
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class GetActiveProjectsAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
try
{
// Gets the list of projects in the service that were opened by the client connected via M:IdeaStatiCa.ConnectionRestApi.Controllers.ClientController.ConnectClient.
List<ConProject> result = await conClient.Project.GetActiveProjectsAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.GetActiveProjectsAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Gets the list of all projects which are currently open in the service for the connected client.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetActiveProjects(IConnectionApiClient conClient)
{
//Open two projects so there is something to list.
await conClient.Project.OpenProjectAsync("Inputs/simple cleat connection.ideaCon");
await conClient.Project.OpenProjectAsync("Inputs/simple knee connection.ideaCon");
//Get all projects opened by this client.
List<ConProject> activeProjects = await conClient.Project.GetActiveProjectsAsync();
Console.WriteLine("Number of active projects: " + activeProjects.Count);
foreach (var project in activeProjects)
{
Console.WriteLine($"Project {project.ProjectId}: '{project.ProjectInfo.Name}' ({project.Connections.Count} connections)");
}
//Close all the opened projects.
foreach (var project in activeProjects)
{
await conClient.Project.CloseProjectAsync(project.ProjectId);
}
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
GET /api/5/projects
Using the GetActiveProjectsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Gets the list of projects in the service that were opened by the client connected via M:IdeaStatiCa.ConnectionRestApi.Controllers.ClientController.ConnectClient.
ApiResponse<List<ConProject>> response = conClient.Project.GetActiveProjectsWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.GetActiveProjectsWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetProjectDataAsync
ConProject GetProjectDataAsync (Guid projectId)
Get data of the project.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the requested project. |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class GetProjectDataAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// Open the project and get its id
var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
Guid projectId = projData.ProjectId;
// (Required) Select parameters
try
{
// Get data of the project.
ConProject result = await conClient.Project.GetProjectDataAsync(projectId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.GetProjectDataAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Gets the data of an open project (project info and the list of connections).
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetProjectData(IConnectionApiClient conClient)
{
string filePath = "Inputs/HSS_norm_cond.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
//Get the data of the open project.
ConProject projectData = await conClient.Project.GetProjectDataAsync(conClient.ActiveProjectId);
Console.WriteLine("Project Id: " + projectData.ProjectId);
Console.WriteLine("Name: " + projectData.ProjectInfo.Name);
Console.WriteLine("Design code: " + projectData.ProjectInfo.CountryCode);
Console.WriteLine("Date: " + projectData.ProjectInfo.Date);
foreach (var connection in projectData.Connections)
{
Console.WriteLine($"Connection {connection.Id}: {connection.Name}");
}
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
GET /api/5/projects/{projectId}
Using the GetProjectDataWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get data of the project.
ApiResponse<ConProject> response = conClient.Project.GetProjectDataWithHttpInfo(projectId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.GetProjectDataWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ImportIOMAsync
ConProject ImportIOMAsync (System.IO.Stream containerXmlFile = null, List
connectionsToCreate = null)
Create the IDEA Connection project from IOM provided in xml format. The parameter 'containerXmlFile' passed in HTTP body represents : IdeaRS.OpenModel.OpenModelContainer which is serialized to XML string by IdeaRS.OpenModel.Tools.OpenModelContainerToXml
Extension Methods
This operation has an avaliable client extension method. Refer to code samples for extension method usage.
CreateProjectFromIomFile(...)
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| containerXmlFile | System.IO.Stream****System.IO.Stream | IdeaRS.OpenModel.OpenModelContainer serialized to xml. | [optional] |
| connectionsToCreate | List<int> | [optional] |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class ImportIOMAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
containerXmlFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | IdeaRS.OpenModel.OpenModelContainer serialized to xml. (optional)
var connectionsToCreate = new List<int>(); // List<int> | (optional)
try
{
// Create the IDEA Connection project from IOM provided in xml format. The parameter 'containerXmlFile' passed in HTTP body represents : [IdeaRS.OpenModel.OpenModelContainer](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs) which is serialized to XML string by [IdeaRS.OpenModel.Tools.OpenModelContainerToXml](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs)
ConProject result = await conClient.Project.ImportIOMAsync(containerXmlFile, connectionsToCreate);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.ImportIOMAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaRS.OpenModel;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Creates a new connection project from a selected IOM file. The first connection point in the IOM file will be added to the project.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task CreateProjectFromIom(IConnectionApiClient conClient)
{
string filePath = "Inputs/multiple_connections.xml";
await conClient.Project.CreateProjectFromIomFileAsync(filePath);
var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
int connectionId = connections[0].Id;
string exampleFolder = GetExampleFolderPathOnDesktop("CreateProjectFromIOM");
// Save updated file.
string fileName = "connection-file-from-IOM.ideaCon";
string saveFilePath = Path.Combine(exampleFolder, fileName);
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
Console.WriteLine("File saved to: " + saveFilePath);
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
/// <summary>
/// Creates a new connection project from a selected IOM file.
/// User can select which connections from the IOM file are to be created in the connection project.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task CreateProjectFromIOM_Multiple(IConnectionApiClient conClient)
{
string filePath = "Inputs/multiple_connections.xml";
//Read IOM to see which connections are in the file.
IdeaRS.OpenModel.OpenModelContainer openModel = Tools.OpenModelContainerFromFile(filePath);
List<int> avaliableConPoints = openModel.OpenModel.ConnectionPoint.Select(x => x.Id).ToList();
Console.WriteLine("Points avaliable for import: " + String.Join(",", avaliableConPoints));
Console.WriteLine("Provide list of points to import seperated by comma. (eg 1, 3, 4)");
List<int> connectionsToCreate = new List<int>();
while (connectionsToCreate.Count < 1)
{
string input = Console.ReadLine();
if (input != null)
{
foreach (var item in input.Split(','))
{
item.Trim();
if (int.TryParse(item, out int conItem))
connectionsToCreate.Add(conItem);
}
if (connectionsToCreate.Count > 0)
break;
}
Console.WriteLine("Connections not input correctly, please provide atleast one connection");
}
await conClient.Project.CreateProjectFromIomFileAsync(filePath, connectionsToCreate);
string saveFilePath = "connection-file-from-IOM-multiple.ideaCon";
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
POST /api/5/projects/import-iom-file
Using the ImportIOMWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Create the IDEA Connection project from IOM provided in xml format. The parameter 'containerXmlFile' passed in HTTP body represents : [IdeaRS.OpenModel.OpenModelContainer](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs) which is serialized to XML string by [IdeaRS.OpenModel.Tools.OpenModelContainerToXml](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs)
ApiResponse<ConProject> response = conClient.Project.ImportIOMWithHttpInfo(containerXmlFile, connectionsToCreate);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.ImportIOMWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 422 | Unprocessable Content | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
OpenProjectAsync
ConProject OpenProjectAsync (System.IO.Stream ideaConFile = null)
Opens an IdeaCon project from the provided file.
Extension Methods
This operation has an avaliable client extension method. Refer to code samples for extension method usage.
OpenProject(...)
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ideaConFile | System.IO.Stream****System.IO.Stream | The IdeaCon file to open. | [optional] |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class OpenProjectAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// (Required) Select parameters
ideaConFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | The IdeaCon file to open. (optional)
try
{
// Opens an IdeaCon project from the provided file.
ConProject result = await conClient.Project.OpenProjectAsync(ideaConFile);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.OpenProjectAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Opens an existing .ideaCon project file in the service and lists the connections it contains.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task OpenProject(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple cleat connection.ideaCon";
//Open the project. It stays open in the service until it is closed.
ConProject project = await conClient.Project.OpenProjectAsync(filePath);
Console.WriteLine("Project opened with Id: " + project.ProjectId);
Console.WriteLine("Project name: " + project.ProjectInfo.Name);
Console.WriteLine("Design code: " + project.ProjectInfo.CountryCode);
foreach (var connection in project.Connections)
{
Console.WriteLine($"Connection {connection.Id}: {connection.Name}");
}
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
POST /api/5/projects/open
Using the OpenProjectWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Opens an IdeaCon project from the provided file.
ApiResponse<ConProject> response = conClient.Project.OpenProjectWithHttpInfo(ideaConFile);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.OpenProjectWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 422 | Unprocessable Content | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateFromIOMAsync
ConProject UpdateFromIOMAsync (Guid projectId, System.IO.Stream containerXmlFile = null)
Update the IDEA Connection project by IdeaRS.OpenModel.OpenModelContainer (model and results). IOM is passed in the body of the request as the xml string. IdeaRS.OpenModel.Tools.OpenModelContainerToXml should be used to generate the valid xml string
Extension Methods
This operation has an avaliable client extension method. Refer to code samples for extension method usage.
UpdateProjectFromIomFile(...)
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the opened project in the ConnectionRestApi service to be updated. | |
| containerXmlFile | System.IO.Stream****System.IO.Stream | IdeaRS.OpenModel.OpenModelContainer serialized to xml. | [optional] |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class UpdateFromIOMAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// Open the project and get its id
var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
Guid projectId = projData.ProjectId;
// (Required) Select parameters
containerXmlFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | IdeaRS.OpenModel.OpenModelContainer serialized to xml. (optional)
try
{
// Update the IDEA Connection project by [IdeaRS.OpenModel.OpenModelContainer](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs) (model and results). IOM is passed in the body of the request as the xml string. [IdeaRS.OpenModel.Tools.OpenModelContainerToXml](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs) should be used to generate the valid xml string
ConProject result = await conClient.Project.UpdateFromIOMAsync(projectId, containerXmlFile);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.UpdateFromIOMAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Updates a connection project (created from IOM) by a new version of the IOM model and results.
/// In a real workflow the updated IOM file would come from a modified FEA model;
/// here the same file is reused to demonstrate the call.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task UpdateFromIOM(IConnectionApiClient conClient)
{
string iomFilePath = "Inputs/multiple_connections.xml";
//Create the project from the IOM file.
await conClient.Project.CreateProjectFromIomFileAsync(iomFilePath);
Console.WriteLine("Project created from IOM with Id: " + conClient.ActiveProjectId);
//Update the open project from the (modified) IOM file - model and results.
ConProject updatedProject = await conClient.Project.UpdateProjectFromIomFileAsync(conClient.ActiveProjectId, iomFilePath);
Console.WriteLine("Project updated from IOM. Number of connections: " + updatedProject.Connections.Count);
string exampleFolder = GetExampleFolderPathOnDesktop("UpdateFromIOM");
string saveFilePath = Path.Combine(exampleFolder, "updated-from-iom.ideaCon");
//Save the updated project.
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
Console.WriteLine("Project saved to: " + saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
POST /api/5/projects/{projectId}/update-iom-file
Using the UpdateFromIOMWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Update the IDEA Connection project by [IdeaRS.OpenModel.OpenModelContainer](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/OpenModelContainer.cs) (model and results). IOM is passed in the body of the request as the xml string. [IdeaRS.OpenModel.Tools.OpenModelContainerToXml](https://github.com/idea-statica/ideastatica-public/blob/main/src/IdeaRS.OpenModel/Tools.cs) should be used to generate the valid xml string
ApiResponse<ConProject> response = conClient.Project.UpdateFromIOMWithHttpInfo(projectId, containerXmlFile);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.UpdateFromIOMWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 422 | Unprocessable Content | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateProjectDataAsync
ConProject UpdateProjectDataAsync (Guid projectId, ConProjectData conProjectData = null)
Updates ConProjectData of project.
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | Guid | The unique identifier of the opened project in the ConnectionRestApi service. | |
| conProjectData | ConProjectData | New project data to apply. The CountryCode field may keep the project's current design code or switch it to one of ECEN, American, Canada, Australia, RUS, CHN, India or HKG; switching to any other value of the enum is refused with 422. None keeps the current code. | [optional] |
Return type
Example
Note: this example is autogenerated.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using IdeaStatiCa.ConnectionApi.Api;
using IdeaStatiCa.ConnectionApi.Client;
using IdeaStatiCa.ConnectionApi.Model;
namespace Example
{
public class UpdateProjectDataAsyncExample
{
public static async Task Main()
{
string ideaConFile = "testCon.ideaCon";
string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 26.0"; // Path to the IdeaStatiCa.ConnectionRestApi.exe
using (var clientFactory = new ConnectionApiServiceRunner(ideaStatiCaPath))
{
using (var conClient = await clientFactory.CreateApiClient())
{
// Open the project and get its id
var projData = await conClient.Project.OpenProjectAsync(ideaConFile);
Guid projectId = projData.ProjectId;
// (Required) Select parameters
var conProjectData = new ConProjectData(); // ConProjectData | New project data to apply. The CountryCode field may keep the project's current design code or switch it to one of ECEN, American, Canada, Australia, RUS, CHN, India or HKG; switching to any other value of the enum is refused with 422. None keeps the current code. (optional)
try
{
// Updates ConProjectData of project.
ConProject result = await conClient.Project.UpdateProjectDataAsync(projectId, conProjectData);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Project.UpdateProjectDataAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
await conClient.Project.CloseProjectAsync(projectId);
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Updates the project information (name, author, description, ...) of an open project.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task UpdateProjectData(IConnectionApiClient conClient)
{
string filePath = "Inputs/simple cleat connection.ideaCon";
await conClient.Project.OpenProjectAsync(filePath);
//Get the current project data and modify the required fields.
ConProject project = await conClient.Project.GetProjectDataAsync(conClient.ActiveProjectId);
ConProjectData projectData = project.ProjectInfo;
projectData.Name = "Updated project name";
projectData.Author = "API user";
projectData.Description = "Project data updated by the Connection API";
projectData.Date = DateTime.Now;
//Send the updated project data to the service.
ConProject updatedProject = await conClient.Project.UpdateProjectDataAsync(conClient.ActiveProjectId, projectData);
Console.WriteLine("Name: " + updatedProject.ProjectInfo.Name);
Console.WriteLine("Author: " + updatedProject.ProjectInfo.Author);
Console.WriteLine("Description: " + updatedProject.ProjectInfo.Description);
string exampleFolder = GetExampleFolderPathOnDesktop("UpdateProjectData");
string saveFilePath = Path.Combine(exampleFolder, "updated-project-data.ideaCon");
//Save the project with the updated data.
await conClient.Project.SaveProjectAsync(conClient.ActiveProjectId, saveFilePath);
Console.WriteLine("Project saved to: " + saveFilePath);
//Close the opened project.
await conClient.Project.CloseProjectAsync(conClient.ActiveProjectId);
}
}
}
Looking for a code sample? request some help on our discussion page.
REST Usage
Http Request
All URIs are relative to http://localhost
PUT /api/5/projects/{projectId}
Using the UpdateProjectDataWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Updates ConProjectData of project.
ApiResponse<ConProject> response = conClient.Project.UpdateProjectDataWithHttpInfo(projectId, conProjectData);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ProjectApi.UpdateProjectDataWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json-patch+json, application/json, text/json, application/*+json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
| 422 | Unprocessable Content | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]