Table of Contents

TemplateApi

Method Description
ApplyTemplateAsync Apply the connection template applyTemplateParam on the connection connectionId in the project projectId.
CreateConTemplateAsync Create a template for the connection connectionId in the project projectId.
CreateTemplateFromConnectionAsync Create a reusable connection template from connectionId with structured metadata. Captures the connection's parametric design — operations, parameters, parametric links, analysis info, loads and clipping/section data — and returns it as a contemp payload alongside metadata inherited from the source connection (design code, version, manufacturing type, member typology, and operation/parameter/link counts).
DeleteAsync Delete specific template.
DeleteAllAsync Delete all templates in connection.
ExplodeAsync Explode specific template (delete parameters, keep operations).
ExplodeAllAsync Explode all templates (delete parameters, keep operations).
GetDefaultTemplateMappingAsync Get the default mappings for the application of the connection template passed in templateToApply on connectionId in the project projectId.
GetTemplateCommonOperationPropertiesAsync Get common properties for specific template.
GetTemplateInConnectionAsync Retrieves a specific template by its ID for a given connection within a project.
GetTemplatesInConnectionAsync Retrieves a list of templates associated with a specific connection within a project.
LoadDefaultsAsync Load parameter defaults for specific template.
UpdateTemplateCommonOperationPropertiesAsync Set common properties for specific template.

ApplyTemplateAsync

ConTemplateApplyResult ApplyTemplateAsync (Guid projectId, int connectionId, ConTemplateApplyParam conTemplateApplyParam = null)

Apply the connection template applyTemplateParam on the connection connectionId in the project projectId.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int Id of the connection where to apply the template.
conTemplateApplyParam ConTemplateApplyParam Template to apply. [optional]

Return type

ConTemplateApplyResult

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 ApplyTemplateAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | Id of the connection where to apply the template.
                    var conTemplateApplyParam = new ConTemplateApplyParam(); // ConTemplateApplyParam | Template to apply. (optional) 

                    try
                    {
                        // Apply the connection template applyTemplateParam on the connection connectionId in the project projectId.
                        ConTemplateApplyResult result = await conClient.Template.ApplyTemplateAsync(projectId, connectionId, conTemplateApplyParam);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.ApplyTemplateAsync: " + 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>
        /// This example applies a template to a naked connection project.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task ApplyTemplate(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            string templateFilePath = "Inputs/template-I-corner.contemp";

            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile(templateFilePath);

            TemplateConversions conversionMapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);

            ConTemplateApplyParam applyParam = new ConTemplateApplyParam();
            
            applyParam.ConnectionTemplate = templateImport.Template;

            //TO DO: We can do some custom mapping if we would like to.
            applyParam.Mapping = conversionMapping;

            var result = conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, applyParam);


            List<int> requestedConnections = new List<int> { connectionId };

            //Calculate the project with the applied template
            List<ConResultSummary> results = await conClient.Calculation.CalculateAsync(conClient.ActiveProjectId, requestedConnections);

            string exampleFolder = GetExampleFolderPathOnDesktop("ApplyTemplate");
            string fileName = "corner-template-applied.ideaCon";
            string saveFilePath = Path.Combine(exampleFolder, fileName);

            //Save the applied template
            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/4/projects/{projectId}/connections/{connectionId}/apply-template

Using the ApplyTemplateWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Apply the connection template applyTemplateParam on the connection connectionId in the project projectId.
    ApiResponse<ConTemplateApplyResult> response = conClient.Template.ApplyTemplateWithHttpInfo(projectId, connectionId, conTemplateApplyParam);
    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 TemplateApi.ApplyTemplateWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: 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]

CreateConTemplateAsync

string CreateConTemplateAsync (Guid projectId, int connectionId)

Create a template for the connection connectionId in the project projectId.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int Id of the connection to be converted to a template.

Return type

string

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 CreateConTemplateAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | Id of the connection to be converted to a template.

                    try
                    {
                        // Create a template for the connection connectionId in the project projectId.
                        string result = await conClient.Template.CreateConTemplateAsync(projectId, connectionId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.CreateConTemplateAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaStatiCa.ConnectionApi;
using System.Text;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// This example creates a connection template (.contemp content) from an existing designed connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task CreateConTemplate(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/simple knee connection.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Create the template content from the design of the connection.
            string templateXml = await conClient.Template.CreateConTemplateAsync(conClient.ActiveProjectId, connectionId);

            Console.WriteLine($"Template created from connection {connectionId}, content length: {templateXml.Length} characters");

            string exampleFolder = GetExampleFolderPathOnDesktop("CreateConTemplate");
            string saveFilePath = Path.Combine(exampleFolder, "knee-connection.contemp");

            //Save the template so it can be re-imported later by Template.ImportTemplateFromFile.
            File.WriteAllText(saveFilePath, templateXml, Encoding.Unicode);
            Console.WriteLine("Template 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

GET /api/4/projects/{projectId}/connections/{connectionId}/get-template

Using the CreateConTemplateWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create a template for the connection connectionId in the project projectId.
    ApiResponse<string> response = conClient.Template.CreateConTemplateWithHttpInfo(projectId, connectionId);
    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 TemplateApi.CreateConTemplateWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain

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]

CreateTemplateFromConnectionAsync

ConTemplateCreateResult CreateTemplateFromConnectionAsync (Guid projectId, int connectionId)

Create a reusable connection template from connectionId with structured metadata. Captures the connection's parametric design — operations, parameters, parametric links, analysis info, loads and clipping/section data — and returns it as a contemp payload alongside metadata inherited from the source connection (design code, version, manufacturing type, member typology, and operation/parameter/link counts).

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The source of the requested template.

Return type

ConTemplateCreateResult

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 CreateTemplateFromConnectionAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The source of the requested template.

                    try
                    {
                        // Create a reusable connection template from connectionId with structured metadata.  Captures the connection's parametric design — operations, parameters, parametric links,  analysis info, loads and clipping/section data — and returns it as a contemp payload  alongside metadata inherited from the source connection (design code, version,  manufacturing type, member typology, and operation/parameter/link counts).
                        ConTemplateCreateResult result = await conClient.Template.CreateTemplateFromConnectionAsync(projectId, connectionId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.CreateTemplateFromConnectionAsync: " + 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;
using System.Text;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// This example creates a reusable connection template with structured metadata from an existing designed connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task CreateTemplateFromConnection(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/simple knee connection.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Create the template and get metadata inherited from the source connection.
            ConTemplateCreateResult result = await conClient.Template.CreateTemplateFromConnectionAsync(conClient.ActiveProjectId, connectionId);

            Console.WriteLine("Template name: " + result.Name);
            Console.WriteLine($"Design code: {result.DesignCode}, manufacturing type: {result.ManufacturingType}");
            Console.WriteLine($"Operations: {result.OperationCount}, parameters: {result.ParameterCount}, parametric links: {result.ParamModelLinkCount}");

            string exampleFolder = GetExampleFolderPathOnDesktop("CreateTemplateFromConnection");
            string saveFilePath = Path.Combine(exampleFolder, "knee-connection.contemp");

            //Save the contemp payload so it can be re-imported later by Template.ImportTemplateFromFile.
            File.WriteAllText(saveFilePath, result.Template, Encoding.Unicode);
            Console.WriteLine("Template 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/4/projects/{projectId}/connections/{connectionId}/templates/create-from-connection

Using the CreateTemplateFromConnectionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create a reusable connection template from connectionId with structured metadata.  Captures the connection's parametric design — operations, parameters, parametric links,  analysis info, loads and clipping/section data — and returns it as a contemp payload  alongside metadata inherited from the source connection (design code, version,  manufacturing type, member typology, and operation/parameter/link counts).
    ApiResponse<ConTemplateCreateResult> response = conClient.Template.CreateTemplateFromConnectionWithHttpInfo(projectId, connectionId);
    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 TemplateApi.CreateTemplateFromConnectionWithHttpInfo: " + 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 -
422 Unprocessable Content -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteAsync

void DeleteAsync (Guid projectId, int connectionId, Guid templateId)

Delete specific template.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection containing the template.
templateId Guid The ID of the template to delete.

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 DeleteAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection containing the template.

                    try
                    {
                        // Delete specific template.
                        conClient.Template.DeleteAsync(projectId, connectionId, templateId);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.DeleteAsync: " + 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>
        /// This example deletes a specific applied template (including its operations) from a connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task Delete(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Guid templateId = templates[0].LibraryTemplateId;

            //Delete the template - its parameters and operations are removed from the connection.
            await conClient.Template.DeleteAsync(conClient.ActiveProjectId, connectionId, templateId);

            var remainingTemplates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Template {templateId} deleted. Templates remaining in connection {connectionId}: {remainingTemplates.Count}");

            //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

DELETE /api/4/projects/{projectId}/connections/{connectionId}/templates/{templateId}

Using the DeleteWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete specific template.
    conClient.Template.DeleteWithHttpInfo(projectId, connectionId, templateId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TemplateApi.DeleteWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/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]

DeleteAllAsync

void DeleteAllAsync (Guid projectId, int connectionId)

Delete all templates in connection.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection from which to delete templates.

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 DeleteAllAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection from which to delete templates.

                    try
                    {
                        // Delete all templates in connection.
                        conClient.Template.DeleteAllAsync(projectId, connectionId);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.DeleteAllAsync: " + 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>
        /// This example deletes all applied templates (including their operations) from a connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task DeleteAll(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Templates in connection {connectionId} before delete: {templates.Count}");

            //Delete all templates - their parameters and operations are removed from the connection.
            await conClient.Template.DeleteAllAsync(conClient.ActiveProjectId, connectionId);

            var remainingTemplates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Templates in connection {connectionId} after delete: {remainingTemplates.Count}");

            //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

DELETE /api/4/projects/{projectId}/connections/{connectionId}/templates

Using the DeleteAllWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete all templates in connection.
    conClient.Template.DeleteAllWithHttpInfo(projectId, connectionId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TemplateApi.DeleteAllWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/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]

ExplodeAsync

void ExplodeAsync (Guid projectId, int connectionId, Guid templateId)

Explode specific template (delete parameters, keep operations).

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection containing the template.
templateId Guid The ID of the template to explode.

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 ExplodeAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection containing the template.

                    try
                    {
                        // Explode specific template (delete parameters, keep operations).
                        conClient.Template.ExplodeAsync(projectId, connectionId, templateId);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.ExplodeAsync: " + 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>
        /// This example explodes a specific applied template - the template binding and its parameters are removed but the operations are kept in the connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task Explode(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Guid templateId = templates[0].LibraryTemplateId;

            //Explode the template - delete its parameters, keep its operations.
            await conClient.Template.ExplodeAsync(conClient.ActiveProjectId, connectionId, templateId);

            var remainingTemplates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            var operations = await conClient.Operation.GetOperationsAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Template {templateId} exploded. Templates remaining: {remainingTemplates.Count}, operations kept in connection: {operations.Count}");

            //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/4/projects/{projectId}/connections/{connectionId}/templates/{templateId}/explode

Using the ExplodeWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Explode specific template (delete parameters, keep operations).
    conClient.Template.ExplodeWithHttpInfo(projectId, connectionId, templateId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TemplateApi.ExplodeWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
204 No Content -
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]

ExplodeAllAsync

void ExplodeAllAsync (Guid projectId, int connectionId)

Explode all templates (delete parameters, keep operations).

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection whose templates are to be exploded.

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 ExplodeAllAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection whose templates are to be exploded.

                    try
                    {
                        // Explode all templates (delete parameters, keep operations).
                        conClient.Template.ExplodeAllAsync(projectId, connectionId);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.ExplodeAllAsync: " + 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>
        /// This example explodes all applied templates in a connection - the template bindings and their parameters are removed but the operations are kept.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task ExplodeAll(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Templates in connection {connectionId} before explode: {templates.Count}");

            //Explode all templates - delete their parameters, keep their operations.
            await conClient.Template.ExplodeAllAsync(conClient.ActiveProjectId, connectionId);

            var remainingTemplates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            var operations = await conClient.Operation.GetOperationsAsync(conClient.ActiveProjectId, connectionId);
            Console.WriteLine($"Templates after explode: {remainingTemplates.Count}, operations kept in connection: {operations.Count}");

            //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/4/projects/{projectId}/connections/{connectionId}/templates/explode

Using the ExplodeAllWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Explode all templates (delete parameters, keep operations).
    conClient.Template.ExplodeAllWithHttpInfo(projectId, connectionId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TemplateApi.ExplodeAllWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
204 No Content -
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]

GetDefaultTemplateMappingAsync

TemplateConversions GetDefaultTemplateMappingAsync (Guid projectId, int connectionId, ConTemplateMappingGetParam conTemplateMappingGetParam = null)

Get the default mappings for the application of the connection template passed in templateToApply on connectionId in the project projectId.

The result IdeaStatiCa.Api.Connection.Model.TemplateConversionsDefault mapping to apply the passed template. It can be modified by a user and used for the application of a template M:IdeaStatiCa.ConnectionRestApi.Controllers.TemplateController.ApplyConnectionTemplateAsync(System.Guid,System.Int32,IdeaStatiCa.Api.Connection.Model.ConTemplateApplyParam,System.Threading.CancellationToken) method.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int Id of the connection to get default mapping.
conTemplateMappingGetParam ConTemplateMappingGetParam Data of the template to get default mapping. [optional]

Return type

TemplateConversions

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 GetDefaultTemplateMappingAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | Id of the connection to get default mapping.
                    var conTemplateMappingGetParam = new ConTemplateMappingGetParam(); // ConTemplateMappingGetParam | Data of the template to get default mapping. (optional) 

                    try
                    {
                        // Get the default mappings for the application of the connection template passed in templateToApply  on connectionId in the project projectId.
                        TemplateConversions result = await conClient.Template.GetDefaultTemplateMappingAsync(projectId, connectionId, conTemplateMappingGetParam);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.GetDefaultTemplateMappingAsync: " + 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>
        /// This example gets the default mapping for the application of a connection template on a connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetDefaultTemplateMapping(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            string templateFilePath = "Inputs/template-I-corner.contemp";
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile(templateFilePath);

            //Get the default mapping of the template items (members, cross-sections, materials, bolts) onto the connection.
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);

            Console.WriteLine("Default mapping conversions: " + mapping.Conversions.Count);
            foreach (BaseTemplateConversion conversion in mapping.Conversions)
            {
                Console.WriteLine($"{conversion.Description}: '{conversion.OriginalValue}' -> '{conversion.NewValue}'");
            }

            //The mapping can be modified and passed to Template.ApplyTemplateAsync in ConTemplateApplyParam.Mapping.

            //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/4/projects/{projectId}/connections/{connectionId}/get-default-mapping

Using the GetDefaultTemplateMappingWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get the default mappings for the application of the connection template passed in templateToApply  on connectionId in the project projectId.
    ApiResponse<TemplateConversions> response = conClient.Template.GetDefaultTemplateMappingWithHttpInfo(projectId, connectionId, conTemplateMappingGetParam);
    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 TemplateApi.GetDefaultTemplateMappingWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: 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]

GetTemplateCommonOperationPropertiesAsync

ConOperationCommonProperties GetTemplateCommonOperationPropertiesAsync (Guid projectId, int connectionId, Guid templateId)

Get common properties for specific template.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection containing the template.
templateId Guid The ID of the template.

Return type

ConOperationCommonProperties

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 GetTemplateCommonOperationPropertiesAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection containing the template.

                    try
                    {
                        // Get common properties for specific template.
                        ConOperationCommonProperties result = await conClient.Template.GetTemplateCommonOperationPropertiesAsync(projectId, connectionId, templateId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.GetTemplateCommonOperationPropertiesAsync: " + 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>
        /// This example gets the common operation properties (plate material, weld material, bolt assembly) of a specific applied template.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetTemplateCommonOperationProperties(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Guid templateId = templates[0].LibraryTemplateId;

            //Get the common properties shared by the operations of the template.
            var commonProperties = await conClient.Template.GetTemplateCommonOperationPropertiesAsync(conClient.ActiveProjectId, connectionId, templateId);

            Console.WriteLine($"Common operation properties of template {templateId}:");
            Console.WriteLine("Plate material Id: " + commonProperties.PlateMaterialId);
            Console.WriteLine("Weld material Id: " + commonProperties.WeldMaterialId);
            Console.WriteLine("Bolt assembly Id: " + commonProperties.BoltAssemblyId);

            //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/4/projects/{projectId}/connections/{connectionId}/templates/{templateId}/common-properties

Using the GetTemplateCommonOperationPropertiesWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get common properties for specific template.
    ApiResponse<ConOperationCommonProperties> response = conClient.Template.GetTemplateCommonOperationPropertiesWithHttpInfo(projectId, connectionId, templateId);
    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 TemplateApi.GetTemplateCommonOperationPropertiesWithHttpInfo: " + 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]

GetTemplateInConnectionAsync

ConConnectionTemplate GetTemplateInConnectionAsync (Guid projectId, int connectionId, int templateInstanceId)

Retrieves a specific template by its ID for a given connection within a project.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the project containing the connection.
connectionId int The identifier of the connection.
templateInstanceId int The instance identifier of the template to retrieve.

Return type

ConConnectionTemplate

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 GetTemplateInConnectionAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The identifier of the connection.
                    templateInstanceId = 56;  // int | The instance identifier of the template to retrieve.

                    try
                    {
                        // Retrieves a specific template by its ID for a given connection within a project.
                        ConConnectionTemplate result = await conClient.Template.GetTemplateInConnectionAsync(projectId, connectionId, templateInstanceId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.GetTemplateInConnectionAsync: " + 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>
        /// This example retrieves a specific applied template by its instance Id in a connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetTemplateInConnection(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            int templateInstanceId = templates[0].TemplateId;

            //Get the template by its instance Id within the connection.
            ConConnectionTemplate template = await conClient.Template.GetTemplateInConnectionAsync(conClient.ActiveProjectId, connectionId, templateInstanceId);

            Console.WriteLine($"Template instance {template.TemplateId} (library template {template.LibraryTemplateId})");
            Console.WriteLine($"Members: {template.Members.Count}, operations: {template.Operations.Count}, parameters: {template.ParameterKeys.Count}");

            //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/4/projects/{projectId}/connections/{connectionId}/templates/{templateInstanceId}

Using the GetTemplateInConnectionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Retrieves a specific template by its ID for a given connection within a project.
    ApiResponse<ConConnectionTemplate> response = conClient.Template.GetTemplateInConnectionWithHttpInfo(projectId, connectionId, templateInstanceId);
    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 TemplateApi.GetTemplateInConnectionWithHttpInfo: " + 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]

GetTemplatesInConnectionAsync

List<ConConnectionTemplate> GetTemplatesInConnectionAsync (Guid projectId, int connectionId)

Retrieves a list of templates associated with a specific connection within a project.

This method fetches the templates applied to a connection within a project. Each template includes details such as its ID within the project, template id, members, operations, parameters, and associated common properties.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the project containing the connection.
connectionId int The identifier of the connection for which templates are to be retrieved.

Return type

List<ConConnectionTemplate>

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 GetTemplatesInConnectionAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The identifier of the connection for which templates are to be retrieved.

                    try
                    {
                        // Retrieves a list of templates associated with a specific connection within a project.
                        List<ConConnectionTemplate> result = await conClient.Template.GetTemplatesInConnectionAsync(projectId, connectionId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.GetTemplatesInConnectionAsync: " + 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>
        /// This example retrieves the list of templates applied on a connection.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task GetTemplatesInConnection(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            //Get all templates applied on the connection.
            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);

            Console.WriteLine($"Templates applied in connection {connectionId}: {templates.Count}");
            foreach (ConConnectionTemplate template in templates)
            {
                Console.WriteLine($"Instance Id: {template.TemplateId}, library template: {template.LibraryTemplateId}, " +
                    $"members: {template.Members.Count}, operations: {template.Operations.Count}, parameters: {template.ParameterKeys.Count}");
            }

            //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/4/projects/{projectId}/connections/{connectionId}/templates

Using the GetTemplatesInConnectionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Retrieves a list of templates associated with a specific connection within a project.
    ApiResponse<List<ConConnectionTemplate>> response = conClient.Template.GetTemplatesInConnectionWithHttpInfo(projectId, connectionId);
    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 TemplateApi.GetTemplatesInConnectionWithHttpInfo: " + 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]

LoadDefaultsAsync

ParameterUpdateResponse LoadDefaultsAsync (Guid projectId, int connectionId, Guid templateId)

Load parameter defaults for specific template.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection containing the template.
templateId Guid The ID of the template whose parameter defaults are loaded.

Return type

ParameterUpdateResponse

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 LoadDefaultsAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection containing the template.

                    try
                    {
                        // Load parameter defaults for specific template.
                        ParameterUpdateResponse result = await conClient.Template.LoadDefaultsAsync(projectId, connectionId, templateId);
                        Debug.WriteLine(result);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.LoadDefaultsAsync: " + 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>
        /// This example loads the parameter defaults of a specific applied template, resetting its parameters to their default values.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task LoadDefaults(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Guid templateId = templates[0].LibraryTemplateId;

            //Load the default values of the template parameters.
            ParameterUpdateResponse response = await conClient.Template.LoadDefaultsAsync(conClient.ActiveProjectId, connectionId, templateId);

            Console.WriteLine($"Defaults loaded for template {templateId}, set to model: {response.SetToModel}");
            Console.WriteLine($"Parameters: {response.Parameters.Count}, failed validations: {response.FailedValidations.Count}");

            //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/4/projects/{projectId}/connections/{connectionId}/templates/{templateId}/load-defaults

Using the LoadDefaultsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Load parameter defaults for specific template.
    ApiResponse<ParameterUpdateResponse> response = conClient.Template.LoadDefaultsWithHttpInfo(projectId, connectionId, templateId);
    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 TemplateApi.LoadDefaultsWithHttpInfo: " + 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 -
422 Unprocessable Content -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateTemplateCommonOperationPropertiesAsync

void UpdateTemplateCommonOperationPropertiesAsync (Guid projectId, int connectionId, Guid templateId, ConOperationCommonProperties conOperationCommonProperties = null)

Set common properties for specific template.

Parameters

Name Type Description Notes
projectId Guid The unique identifier of the opened project in the ConnectionRestApi service.
connectionId int The ID of the connection containing the template.
templateId Guid The ID of the template.
conOperationCommonProperties ConOperationCommonProperties Common properties to apply (specify material IDs, or keep as null). [optional]

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 UpdateTemplateCommonOperationPropertiesAsyncExample
    {
        public static async Task Main()
        {
            string ideaConFile = "testCon.ideaCon";
            
            string ideaStatiCaPath = "C:\\Program Files\\IDEA StatiCa\\StatiCa 25.1"; // 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
                    connectionId = 56;  // int | The ID of the connection containing the template.
                    var conOperationCommonProperties = new ConOperationCommonProperties(); // ConOperationCommonProperties | Common properties to apply (specify material IDs, or keep as null). (optional) 

                    try
                    {
                        // Set common properties for specific template.
                        conClient.Template.UpdateTemplateCommonOperationPropertiesAsync(projectId, connectionId, templateId, conOperationCommonProperties);
                    }
                    catch (ApiException  e)
                    {
                        Console.WriteLine("Exception when calling Template.UpdateTemplateCommonOperationPropertiesAsync: " + e.Message);
                        Console.WriteLine("Status Code: " + e.ErrorCode);
                        Console.WriteLine(e.StackTrace);
                    }
                    finally
                    {
                        await conClient.Project.CloseProjectAsync(projectId);
                    }
                }
            }
        }
    }
}

Code Samples

using IdeaRS.OpenModel.Material;
using IdeaStatiCa.Api.Connection.Model;
using IdeaStatiCa.ConnectionApi;

namespace CodeSamples
{
    public partial class ClientExamples
    {
        /// <summary>
        /// This example updates the common operation properties (plate material, weld material, bolt assembly) of a specific applied template.
        /// </summary>
        /// <param name="conClient">The connected API Client</param>
        public static async Task UpdateTemplateCommonOperationProperties(IConnectionApiClient conClient)
        {
            string filePath = "Inputs/corner-empty.ideaCon";
            await conClient.Project.OpenProjectAsync(filePath);

            var connections = await conClient.Connection.GetConnectionsAsync(conClient.ActiveProjectId);
            int connectionId = connections[0].Id;

            //Apply a template first so the connection contains an applied template.
            ConTemplateMappingGetParam templateImport = conClient.Template.ImportTemplateFromFile("Inputs/template-I-corner.contemp");
            TemplateConversions mapping = await conClient.Template.GetDefaultTemplateMappingAsync(conClient.ActiveProjectId, connectionId, templateImport);
            await conClient.Template.ApplyTemplateAsync(conClient.ActiveProjectId, connectionId, new ConTemplateApplyParam { ConnectionTemplate = templateImport.Template, Mapping = mapping });

            List<ConConnectionTemplate> templates = await conClient.Template.GetTemplatesInConnectionAsync(conClient.ActiveProjectId, connectionId);
            Guid templateId = templates[0].LibraryTemplateId;

            //Read the current common properties of the template operations.
            var commonProperties = await conClient.Template.GetTemplateCommonOperationPropertiesAsync(conClient.ActiveProjectId, connectionId, templateId);

            //Set the plate material of all template operations to the first steel material in the project.
            List<MatSteel> steelMaterials = (await conClient.Material.GetSteelMaterialsAsync(conClient.ActiveProjectId)).Cast<MatSteel>().ToList();
            commonProperties.PlateMaterialId = steelMaterials[0].Id;

            await conClient.Template.UpdateTemplateCommonOperationPropertiesAsync(conClient.ActiveProjectId, connectionId, templateId, commonProperties);

            var updatedProperties = await conClient.Template.GetTemplateCommonOperationPropertiesAsync(conClient.ActiveProjectId, connectionId, templateId);
            Console.WriteLine($"Common properties of template {templateId} updated. Plate material Id: {updatedProperties.PlateMaterialId}");

            //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/4/projects/{projectId}/connections/{connectionId}/templates/{templateId}/common-properties

Using the UpdateTemplateCommonOperationPropertiesWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Set common properties for specific template.
    conClient.Template.UpdateTemplateCommonOperationPropertiesWithHttpInfo(projectId, connectionId, templateId, conOperationCommonProperties);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling TemplateApi.UpdateTemplateCommonOperationPropertiesWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
204 No Content -
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]