IRestClient interface
Overview
The REST SDK works with the IRestClient
interface and can be used through dependency injection. The IRestClient
interface has the following primary methods for working with data:
GetItem
GetItems
CreateItem
UpdateItem
DeleteItem
Use in Sitefinity ASP.NET Renderer projects
The IRestClient
interface is automatically registered and is initialized for each request.
To use it, you need to inject it in the constructor through dependency injection (DI), like in the following example:
Use in custom implementations in Sitefinity ASP.NET Renderer projects
To use the IRestClient
interface in custom controllers, you need to manually initialize the interface, like in the following example:
Use in custom implementations in external ASP.NET Core projects
To use the IRestClient
interface in external projects, which do not use Sitefinity ASP.NET Core Renderer, you need to manually:
- Register the
IRestClient
interface on startup by adding the following services:
- Initialize the
IRestClient
interface for custom implementations, like in the example above.
Examples
The following examples demonstrate how to use the IRestClient
interface:
- Sample: Migrate data to Sitefinity CMS
- Sample: Share data between widgets
- Sample: Mega menu