Let Sitefinity Implement Web Services for You

Let Sitefinity Implement Web Services for You

Posted on December 28, 2016 0 Comments

With Progress Sitefinity, you can create dynamic content types without any overhead. Editing content items is also really easy. But while all of this sounds great on paper, developers ultimately need to have more control via an API.

With the .NET managers, you are able to manipulate the items, but this is from C# code and it doesn’t work on the client side. To invoke some functionality from there, you have to implement custom web services and expose an endpoint in the backend. The process for this is straightforward but you may feel that this can be automated somehow… and it can! With Sitefinity, you are able to create a web service with OData support for each content type

Creating a Web Service—The Easy Way

To showcase how this is done, I am going to use the Quantum sample application. Go to Administration>Web services and create a new web service.

The URL is generated directly from the name of the web service and, in case you want to shorten it, you have the option to change it.

The next option is to setup the permissions. When the access to the web services requires authentication, you should log in to the system via a specific end point and then use the generated token in order to request the data. Here is one Postman collection that can be used as a reference.

The next step is choosing which content type to expose.

We recommend selecting only the content types that you need. It is better to have many services doing one thing instead of one service giving access to all of the data types, as this will eventually become nearly unmanageable at some point.

One powerful feature here is that each content type can be fine-tuned separately, from access level to the used fields.

On a service level, you are able to control whether you want to automatically add the newly created content types to the web service. On a content level, this can be applied to the newly added fields. With that option, you don’t have to configure the service each time when a change is applied to your data schema.   

Start with Examples

Click on the “Use in your app” link on the right side of the web service and a RESTful API documentation will appear. Everything there is described in detail, including how it should be used. 

The generated help is great, but I would like to go one step further and give you a collection in Postman that will make it far easier for you to get started. This collection will be particularly helpful if you don’t have much experience with OData.

Once you are familiar with the above, there will come a moment when you want to bind some controls to your data. We recommend that you stick with Kendo UI. Head over to GitHub to find samples that will help you integrate the end points with the widgets.

If you want to use third-party components, you should use the JavaScript SDK, which will save you a ton of time and energy.

Conclusion

Progress advocates for the usage of the built-in services instead of creating new ones from scratch. With the web service builder, you are able to accomplish every scenario that you may want and save time that you can invest in other mission-critical parts of your projects.

With each release, new optimizations are made—for example, with version 9.2, the optimizations affect fields of Тaxonomies type and statically linked relations (child->parent, /item?$expand=Parent) and validation checks for different fields. The improvements and new features are numerous and can be found in the documentation. Our goal is to provide you with everything out of the box without the need to write additional code. Share your suggestions and the development team can turn them into reality.

Peter Filipov

Peter Filipov

Peter Filipov (Pepi) is a Product Builder focused on building the future of Sitefinity, relying on the newest technologies such as .NET 6 (and up), React and Angular. His previous experience as a Developer Advocate and Manager of Engineering helps him to understand the customers’ and market needs of Sitefinity. He also is passionate about being active and healthy.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation