The TourCMS API .NET Client Library class is intended to provide a simple wrapper for the TourCMS Marketplace API. It takes care of authentication and exposes wrapper functions for all methods currently available in the API.
If you have a Supplier account please review the checklist at the top of the API information page.
If you have a Partner account you will need to connect to at least one Supplier who has products available. You can check by logging in to your Partner account and clicking "Search & Book". If you can see some products visible then you are good to go, if not you will need to connect to some additional Suppliers, or ask your existing connections to load some products.
If you have downloaded the dll file continue to Step 2, if you have the full Visual Studio 2010 source code just open the solution in Visual Studio and load some settings for the TestApp.
If you have NuGet package manager installed, search for TourCMS in the GUI, or Install-Package TourCMS in the console.
Download the library from the link above, extract the .dll to your local machine and then just Add a Reference to it in Visual Studio. How to: Add or Remove References in Visual Studio.
Visual studio 2010 users will need to target the full version of ".NET Framework 4" (or 3.5), targetting ".NET Framework 4 Client Profile" will result in errors at build time. Troubleshooting .NET Framework Targeting Errors.
object TourCMS.Utils.marketplaceWrapper ( int marketplaceId, string privateKey )
using TourCMS.Utils; using System.Xml; ... // Set your Marketplace ID // For Suppliers this will be 0 // For Partners this can be found in the API settings page int marketplaceId = 0; // Create a new Instance of the TourCMS API class marketplaceWrapper myTourCMS = new marketplaceWrapper(marketplaceId, "YOUR_PASSWORD_HERE");
Imports TourCMS.Utils Imports System.Xml ... ' Set your Marketplace ID ' For Suppliers this will be 0 ' For Partners this can be found in the API settings page Dim marketplaceId As Integer = 0 ' Create a new Instance of the TourCMS API class Dim myTourCMS As New marketplaceWrapper(marketplaceId, "YOUR_PASSWORD_HERE")
The simplest call is one to get back information on your current API rate limit:
// Set the Channel ID // For Suppliers this can be found in the API settings page // For Partners this will be 0 int channelId = 0; // Query the TourCMS API XmlDocument doc = myTourCMS.ApiRateLimitStatus(channelId); // Print out the remaining hits string limit = doc.SelectSingleNode("//remaining_hits").InnerText; Console.WriteLine("Remaining hits: " + limit);
' Set the Channel ID ' For Suppliers this can be found in the API settings page ' For Partners this will be 0 Dim channelId As Integer = 0 ' Query the TourCMS API Dim doc As XmlDocument = myTourCMS.ApiRateLimitStatus(channelId) ' Print out the remaining hits Dim limit As String = doc.SelectSingleNode("//remaining_hits").InnerText Console.WriteLine("Remaining hits: " & limit)
Remaining hits: 500
The full source code for this example is included in the zip file. Additional .Net examples are available on the individual pages linked from the method list.
The library is provided under an MIT license which allows you absolute flexibility in re-use and distribution, you may use the library in your own closed source or open source applications. If you would prefer to receive the library under another license please contact us.