Connect your .NET applications to Cloud CMS
Current version: 1.1.6. Released Dec 14, 2021
The Cloud CMS C# driver allows you to easily connect your C# and .NET applications to the Cloud CMS server.
Currently supports the following functionality:
- Connect to and refresh access tokens with the API
- Read platform, branch, and repositories
- Read, query, search, create, update, and delete nodes
Install this driver as you would any other NuGet package
dotnet add package cloudcms
Connecting to Cloud CMS
To connect to Cloud CMS, use the static
CloudCMSDriver.ConnectAsync method. This takes either a file path to a
a JObject json object, dictionary, or ConnectionObject.
The required API key properties for this are:
string path = "gitana.json"; IPlatform platform1 = await CloudCMSDriver.ConnectAsync(path); JObject configObj = ...; IPlatform platform2 = await CloudCMSDriver.ConnectAsync(configObj); IDictionary
configDict = ...; IPlatform platform3 = await CloudCMSDriver.ConnectAsync(configDict); ConnectionConfig config = ...; IPlatform platform4 = await CloudCMSDriver.ConnectAsync(config);
Below are some examples of how you might use the driver:
// Connect to Cloud CMS string path = "gitana.json"; IPlatform platform = await CloudCMSDriver.ConnectAsync(path); // Read repository IRepository repository = await platform.ReadRepositoryAsync("<repositoryId>"); // Read branch IBranch branch = await repository.ReadBranchAsync("<branchId>"); // Read node INode node = await branch.ReadNodeAsync("<nodeID>"); // Update node node.Data["title"] = "A new title"; await node.UpdateAsync(); // Delete node await node.DeleteAsync(); // Create node JObject obj = new JObject( new JProperty("title", "Twelfth Night"), new JProperty("description", "An old play") ); INode newNode = await branch.CreateNodeAsync(obj); // Query nodes JObject query = new JObject( new JProperty("_type", "store:book") ); JObject pagination = new JObject( new JProperty("limit", 2) ); List<INode> queryNodes = await branch.QueryNodesAsync(query, pagination); // Search/Find nodes JObject find = new JObject( new JProperty("search", "Shakespeare"), new JProperty("query", new JObject( new JProperty("_type", "store:book") ) ) ); List<INode> findNodes = await branch.FindNodesAsync(find, pagination);
The C# driver is a useful library that provides access to the capabilities of Cloud CMS from a programmatic perspective. It is therefore important to first familiarize yourself with the concepts presented in the Cloud CMS Documentation.
Check out our Cloud CMS C# Cookbook for recipes and examples using the C# Driver.
Fork the Code
The Cloud CMS C# driver is 100% open-source (Apache 2.0) and so you're free to fork it, extend it and dig into it to learn about how it works.
Bugs / Problems
The C# driver is free to use in your applications and projects. It is fully supported by Cloud CMS.