Documentation
API Libraries
.NET API
Overview
The .NET api allows developers to integrate cloudinclude hosted content into their ASP.NET web applications for those that choose not to use the Javascript method and prefer to render all content on the server side. The following documentation walks you through how to add the .NET library to a standard ASP.NET web application and leverage the core functions of the .NET api.
Getting Started
Follow the steps below to get your first ASP.NET project up and running with cloudinclude.
(Steps and screenshots are based off of the Visual Studio 2008 IDE.)
-
Make sure to first download the .NET dll library here.
-
Right click your project node from the Solution Explorer and select 'Add Reference...'
-
Browse to the cloudinclude dll library downloaded from step 1 and click 'OK' to add the library to your project.
- Now that you have added the dll library to your project you are ready to start accessing cloudinclude's class libraries to communicate with cloudinclude's servers from within your project. The next section contains a complete example on how to use some of the main classes and functions in the library.
Complete Example
The following code is the code-behind for a generic '.aspx' page file written in C#. There are two things going on in the code below. First, a piece of content specified by an id parameter is retrieved and output to the browser via the GetContentById method. Secondly, all contents associated to a tag are retrieved by tag id and output to the browser via the GetContentByTagId method. Copy and paste the code below into your code file to get started.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Cloudinclude.DataAdapter da = new Cloudinclude.DataAdapter();
// 1. Retrieving content by identifier
Cloudinclude.Content content = da.GetContentById("81d1ca622ede3a7027b0489f8e5e7da7");
// 2. Display the content
Response.Write("DISPLAYING CONTENT: <br />");
Response.Write("id: " + content.guid + "<br />");
Response.Write("name: " + content.name + "<br />");
Response.Write("content: " + content.content + "<br />");
// 3. Retrieving all content associated by a particular tag
Cloudinclude.Content[] contents = da.GetContentByTagId("zdagdede3a7027b0489f8e5e7da7");
// 4. Display each content from the array
Response.Write("DISPLAYING TAGGED CONTENT: <br />");
foreach (Cloudinclude.Content i in contents)
{
Response.Write("id: " + i.guid + "<br />");
Response.Write("name: " + i.name + "<br />");
Response.Write("content: " + i.content + "<br />");
}
}
}
Please note the highlighted portions in the code above. In red are the unique ids that reference the content id and tag id respectively that you wish to access. Please replace these ids with those pertinent to your project. You can pull these ids from the content administration area or refer to the Function Reference section below for additional functions for id retrieval.
Once you have updated the ids you can compile and run the code as is.
As you may have noticed, the function calls GetContentById and GetContentByTagId are part of the DataAdapter class of the Cloudinclude namespace. In fact, all of the function calls you will need to interact with cloudinclude are contained in this class. So before you can use any of the functions, you must instantiate an object of the Cloudinclude.DataAdapter class. This is done in the first line in the code above.
GetContentById and GetContentByTagId respectively return an object of class Cloudinclude.Content and an array of Cloudinclude.Content objects. The Content object contains properties for acccessing your content's data. Refer to the next section for details on all of the available functions at your disposal.
Function Reference
DataAdapter Class
Methods
| Method | Returns | Description |
| GetContentById(string contentId) | Cloudinclude.Content | Retrieves content identified by contentId and returns an object of Cloudinclude.Content. |
| GetContentByTagId(string tagId) | Cloudinclude.Content[] | Retrieves content associated by the tag identified by tagId and returns them in an array. |
| GetTagsByProjectId(string projectId) | Cloudinclude.Tag[] | Retrieves all tags tied to a project identified by projectId and returns them in an array. |
| GetContentByProjectId(string projectId) | Cloudinclude.Content[] | Retrieves all content tied to a project identified by projectId and returns them in an array. |
Content Class
Properties
| Property | Data Type | Description |
| guid | string | The content's unique identifier |
| name | string | The content's name header value |
| content | string | The body of the content |
Tag Class
Properties
| Property | Data Type | Description |
| guid | string | The tag's unique identifier |
| name | string | The tag's name header value |
Download
Click here to download the current version of the .NET library.