The host is the primary interaction point in the SDK. It is through the host that you will setup your environment to use the SDK and through the host you will interact with the SDK.
What is a Host?
A host is any class that extends the RestHost abstract class:
Telligent.Evolution.Extensibility.Rest.Version1.RestHost
You can view the full source here. NOTE: The interface of RestHost is considered an API, the implementation of it is not.
In the SDK we ship 2 types of host, a Default REST Host and Client Credentials REST Host. You can also create your own Custom REST Host if the need arises.
Hosts once implemented can be configured or instantiated differently depending on how the Host is written. For example the Default REST Host self instantiates through a loading method and a configuration file while the Client Credentials REST Host is instantiated like any normal class.
How Hosts Work
As mentioned a host implementation can do many things, but any host has very specific roles in the SDK. These fundamentals are required by any host implementation.
Hosts are responsible for knowing about your community. Specifically where it is. Since this is a REST SDK it is important to know the URL of the community.
Hosts are responsible for authentication. Any requests made to REST via the SDK are relayed through a host and as such the host is responsible for attaching authentication information to each request. Currently all hosts in the SDK use OAuth, so that means when a REST request is made, the host is responsible for adding the token to the request. Alternatively a custom host could be written that uses API keys. A Host is NOT responsible for understanding the current user, this would be something specific to an implementation of a host, not generic functionality. You will see how hosts handle this in host specific topics.
Hosts manage cache. By default a host exposes a simple memory based cache and access to it. It does not however manage the items in cache, only the existence of the cache. Cache can in turn be used by the implementation as needed.
Hosts provide the REST interface. It is through the host that you make all your GET/PUT/POST and DELETE requests. For this set there is a response of dynamic, stream, string and XElement. For each of those there is a Sync and Async method if you want to do it in or out of process. The details are covered in Basic Requests. In addition, Hosts manage things like timeout rules and adding additional headers as needed depending on the hosts specific needs.