ClientApi
| Method | Description |
|---|---|
| ConnectClientAsync | Connects a client to the ConnectionRestApi service and returns a unique identifier for the client. |
| GetVersionAsync | Gets the IdeaStatica API assembly version. |
ConnectClientAsync
string ConnectClientAsync ()
Connects a client to the ConnectionRestApi service and returns a unique identifier for the client.
Parameters
This endpoint does not need any parameter.
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 ConnectClientAsyncExample
{
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())
{
// (Required) Select parameters
try
{
// Connects a client to the ConnectionRestApi service and returns a unique identifier for the client.
string result = await conClient.Client.ConnectClientAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Client.ConnectClientAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Shows how a client is connected to the ConnectionRestApi service.
/// The SDK calls the connect-client endpoint automatically when the API client is created
/// and passes the obtained ClientId in the header of all subsequent requests.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task ConnectClient(IConnectionApiClient conClient)
{
//The ClientId was obtained from the connect-client endpoint when this client was created.
Console.WriteLine("ClientId of this connected client: " + conClient.ClientId);
//The raw endpoint can also be called directly.
//Each call registers a new client in the service and returns its unique identifier.
//Note: this API client keeps using its original ClientId from above.
string newClientId = await conClient.ClientApi.ConnectClientAsync();
Console.WriteLine("ClientId returned by a direct connect-client call: " + newClientId);
}
}
}
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/clients/connect-client
Using the ConnectClientWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Connects a client to the ConnectionRestApi service and returns a unique identifier for the client.
ApiResponse<string> response = conClient.Client.ConnectClientWithHttpInfo();
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 ClientApi.ConnectClientWithHttpInfo: " + 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 | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetVersionAsync
string GetVersionAsync ()
Gets the IdeaStatica API assembly version.
Parameters
This endpoint does not need any parameter.
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 GetVersionAsyncExample
{
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())
{
// (Required) Select parameters
try
{
// Gets the IdeaStatica API assembly version.
string result = await conClient.Client.GetVersionAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling Client.GetVersionAsync: " + e.Message);
Console.WriteLine("Status Code: " + e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
finally
{
}
}
}
}
}
}
Code Samples
using IdeaStatiCa.ConnectionApi;
namespace CodeSamples
{
public partial class ClientExamples
{
/// <summary>
/// Gets the version of the running IDEA StatiCa Connection API service.
/// Useful to verify which service version the client is connected to.
/// </summary>
/// <param name="conClient">The connected API Client</param>
public static async Task GetVersion(IConnectionApiClient conClient)
{
//Get the IdeaStatiCa API assembly version of the running service.
string version = await conClient.ClientApi.GetVersionAsync();
Console.WriteLine("Connected to IDEA StatiCa Connection API service version: " + version);
}
}
}
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/clients/idea-service-version
Using the GetVersionWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Gets the IdeaStatica API assembly version.
ApiResponse<string> response = conClient.Client.GetVersionWithHttpInfo();
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 ClientApi.GetVersionWithHttpInfo: " + 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 | - |
| 500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]