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.SDK | Helper classes that streamline the implementation |
---|---|
MTMConnect.SDK\Models\Authentication | Models that are required to get a security token to access MTMConnect. |
MTMConnect.SDK\Models\Request | Models that are used to apply filters on the request to get data. |
MTMConnect.SDK\Models\Response | Models that come as response from MTMConnect e.g. Class, Course, Response, etc. |
MTMConnect.SDK\HttpUtiliy | Helper class to create an HTTP request. |
MTMConnect.SDK\Authentication | Helper class to get authentication token. |
MTMConnect.SDK\API | Helper class to make calls to MTMConnect. |
MTMConnectClient | Minimum requirements for posting data to MTMConnect |
---|---|
MTMConnectClient\App.config | Configuration details that are required to run the application. |
MTMConnectClient\Program.cs | The 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\ImportFiles | Sample files that can be used for import. |
MTMConnectClient\ExportFiles | Static class that give a sample object for a request. |
Back to top