Creating a client - Metasys - LIT-12013522 - Software Application - Basic Services client library for .NET (and COM) - Metasys API - 4.2

Metasys REST Client for .NET and COM Developer Guide

Brand
Metasys
Product name
Basic Services client library for .NET (and COM)
Metasys API
Document type
API Reference Guide
Document number
LIT-12013522
Version
4.2
Revision date
2021-04-07
Language
English (United States)

Create a client in order to connect to the Metasys server and issue functional calls. To create a client, use the following GUID method. When you create the client, choose from the following optional parameters to suit your requirements.

GUID method

var client = new MetasysClient("hostname");

API version

If your server is not a 10.1 Metasys server or later, the library will not function correctly. The version parameter takes in the API version enumeration value that defaults to the most current release of Metasys. For Metasys 11.0 the API is v3. For Metasys 10.1 the API is v2. Version parameter: apiVersion.

To change the API version or the hostname after creating a client, use the following method. If you change one of these properties, the system resets the access token and you need to login again.

// Changing Api version after creating a client
var client = new MetasysClient("hostname",version: ApiVersion.v3);
client.Version = ApiVersion.v2;
// Changing Metasys Server after creating a client
var client = new MetasysClient("hostname");
client.Hostname = "WIN2016-VM2";

Language for localization

To set the language for localization, specify the country and region with a culture information object. The default culture is en-US. Culture parameter: cultureInfo

To create a client for a 11.0 Metasys server with Italian translations of values, use the following method.

CultureInfo culture = new CultureInfo("it-IT");
var client = new MetasysClient(hostname, true, ApiVersion.v3, culture);

Transport layer security (TLS) certificate

Ensure the Metasys server has a valid TLS certificate. If your server does not have a valid certificate, the MetasysClient object produces an error message and blocks the connection.

However, if you set the ignore certificate parameter to true, the MetasysClient object ignores the error and makes an insecure connection with the server. When you use the ignoreCertificateErrors parameter you put your server at risk of a man-in-the-middle security attack.
Important: Do not do this on a production site.
For more information, refer to Appendix: Certificate management and security section in the Metasys Server Installation and Upgrade Instructions (LIT-12012162).