Back

Sample client code in MTM API

The sample client app in C# may be found in the following GitHub repository: GITHub - explorance/exploranceapis-mtmconnect-csharp. The C# implementation of Explorance's MTM Connect APIs may be found in this repository.

Prerequisites

Please make sure you populate the entries shown below in the app.config file before you try running the application:

Please use the config entries shown below from the config file:

Authentication

For any request to MTMConnect to succeed you need a valid authentication token. The code has helper methods to get the authentication token:

The tokenResponse object in the code snippet shown above holds the response from the authentication service. To obtain the token use the code shown below:

Project structure

MTMConnect.SDKHelper classes that streamline the implementation
MTMConnect.SDK\Models\AuthenticationModels that are required to get a security token to access MTMConnect.
MTMConnect.SDK\Models\RequestModels that are used to apply filters on the request to get data.
MTMConnect.SDK\Models\ResponseModels that come as response from MTMConnect e.g. Class, Course, Response, etc.
MTMConnect.SDK\HttpUtiliyHelper class to create an HTTP request.
MTMConnect.SDK\AuthenticationHelper class to get authentication token.
MTMConnect.SDK\APIHelper class to make calls to MTMConnect.
MTMConnectClientMinimum requirements for posting data to MTMConnect
MTMConnectClient\App.configConfiguration details that are required to run the application.
MTMConnectClient\Program.csThe starting point where the client can make changes and try using MTMConnect. All the prerequisites needed to run are to be configured in the above App.config file.
MTMConnectClient\ImportFilesSample files that can be used for import.
MTMConnectClient\ExportFilesStatic class that give a sample object for a request.
Back to top

Copyright © 2025

Explorance Inc. All rights reserved.