The samples in this section use Sitefinity CMS News items. The samples focus on the data function of the sitefinity object that returns a data object. The data object is the mechanism that enables Sitefinity JS SDK to work with the OData services.
data
sitefinity
In the following samples, the dataOptions object specifies which content item to query. It has the following properties:
dataOptions
urlName
providerName
cultureName
As a result, you get the data object and you can call its various functions, such as:
get
getSingle
create
update
destroy
upload
These functions accept an object, which has the following functions and properties:
successCb
failureCb
query
EXAMPLE: (endswith(Record, 'Title') or (age ne '15') or (Content eq 'test')
(endswith(Record, 'Title') or (age ne '15') or (Content eq 'test')
action
fallbackProperties
Title
NOTE: There is a limitation in the OData web services that limits the maximum items in a query to 50. To change this limit in Sitefinity CMS backend, navigate to Administration » Settings » Advanced » WebServices » Routes » Frontend » Services » <your service> » <content type>. Change the value of Default page size field.
The following sample demonstrates how to query multiple news items, by using the get function of the data object:
The following sample demonstrates how to query a single news item, by using the getSingle function of the data object:
The following sample demonstrates how to create a News item, by using the create function of the data object:
The following sample demonstrates how to update a News item, by using the update function of the data object:
The following sample demonstrates how to delete a News item, by using the destroy function of the data object:
A media item upload request requires you to send headers with the request. This sample demonstrates how to upload an image in JPEG format. Therefore, you must send the following headers with the request:
The following sample sends three requests in a batch request to Sitefinity CMS:
POST
PATCH
NOTE: This sample assumes that there is an <input type="file" name="photo" id="photo"> element present in your application.
<input type="file" name="photo" id="photo">
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important