sitecore,sitecore8 , How can I wrap the Sitecore 8 itemWebApi to apply custom business logic to API responses?


How can I wrap the Sitecore 8 itemWebApi to apply custom business logic to API responses?

Question:

Tag: sitecore,sitecore8

I have a requirement to build a service endpoint to provide specific Sitecore 8.0 items (containing a given field value in a given branch of the content tree) to requesting mobile app clients. Encapsulating this logic (and perhaps some other calculations, etc) means the out-of-the-box API is not suitable.

I'd like to mimic an existing SOAP service exposed by another CMS, however I'm not above using a modified version of the RESTful itemWebApi if it confers greater code reusability or upgrade-safety.

Based on my research thusfar, it would appear my options are to build a custom handler, a completely separate asmx service (ala this approach), or to build a custom controller (similar to this custom Web API controller method).

Overriding or replacing the default pipeline processors for the itemWebApi does not seem viable, as I don't want to replace/modify the OOB API if I can avoid it.

Has anyone with the same type of requirement for Sitecore 8 found a better approach?


Answer:

The approach I chose was to create a separate service "router" developed using the adapter pattern to be consumed by our mobile app clients. The router in turn calls the Sitecore ItemWebApi.

This fit my needs the best as it is completely decoupled from the Sitecore application and the client can be modified if necessary without impacting the endpoint.


Related:


Where to create the Articles in Sitecore?


sitecore,bucket
I'm trying to understand the best approach to create article items in my sitecore 7.2 project. Basically I'm considering 2 options: 1 - Create an article as a page; 2 - Create an article as a Site Data Item. 1 - Create article pages under a given page (i.e. My...

Is there an easy way to fake a Sitecore Device for testing?


sitecore
We have a custom device set-up in a Sitecore installation. Is there an easy way to get my desktop to render that? I'd imagine there should be a nice parameter sc_device= we can tag onto the url, but it doesn't seem so...

Server error in '/' application on selecting any country list from dropdown list in sitecore


asp.net,validation,sitecore
I have sucessfully redirect one of my page to 404 error page using redirection in sitecore. Problem is when i am selecting any country from dropdown list i am getting below error : "Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %>...

How can I wrap the Sitecore 8 itemWebApi to apply custom business logic to API responses?


sitecore,sitecore8
I have a requirement to build a service endpoint to provide specific Sitecore 8.0 items (containing a given field value in a given branch of the content tree) to requesting mobile app clients. Encapsulating this logic (and perhaps some other calculations, etc) means the out-of-the-box API is not suitable. I'd...

Sitecore logs full with WARN Datakey length bigger then 100 chars, and was trimmed


sitecore,sitecore-dms
We are having some problems with the following line in the log files of Sitecore: WARN Datakey length bigger then 100 chars, and was trimmed It's not really a massive problem, but it is logging this up to 2000 times in one day. If I have investigated further: probably it...

Adding Sitecore 7.5 to existing solution


asp.net-mvc,sitecore,sitecore7.5
I am trying to add the Sitecore as a separate project to an existing .Net MVC project which is built in .net framework 4.5.1.I followed the below steps to do so. Copied Images,Assets,Scripts,Fonts folders from the existing Sample.Web project in to the sitecore project (now the sitecore project is the...

How should I start a Sitecore campaign when the entrance page is an alias?


sitecore,sitecore7.2,sitecore-dms
We have a site with extensive use of product specific contact forms (Web forms for marketers module), so that almost any page can be considered a landing page. We want to run campaigns that make use of existing pages/forms instead of creating new pages specific to the campaign. As we...

Sitecore WFFM error Unknown connection string. Name: 'wfm'


sitecore
I am new in Sitecore, i have created form using WFFM and i want to save form in sqlServer, so i have installed SaveToDatabase from here, trying to save from in database but it is giving error: 4184 20:12:45 INFO HttpModule is being initialized 4184 20:12:46 ERROR Save To Database...

Running code on Page Editor load in Sitecore


sitecore
I need to run code on load of Page Editor. What I want to do is check the current version that is being loaded and if it's not the latest version, make it not editable. I've looked at various http piplines, but it's not clear how I get the current...

Update Sitecore and SIP together?


sitecore,sip
I currently have the task of updating a Sitecore Instance 6.6 with SIP 3.2. The target is reaching Sitecore 7.0, so we can use Item Buckets. The problem is when I update Sitecore to 7.0, it doesn't work with SIP 3.2, because assembly references doesn't match anymore and Sitecore 7.0...

Is @Html.Sitecore().VisitorIdentification() required with Sitecore 8 MVC?


sitecore,sitecore-mvc,sitecore8
Is the following call to VistorIndentification() still required within Sitecore 8 MVC layouts / views? @using Sitecore.Mvc.Analytics.Extensions @Html.Sitecore().VisitorIdentification() Even without it, page visits appeared to be tracked in Tracker.Current.Contact.System.VisitCount and within the Experience Profile information. What feature or tracking ability is dependant on this?...

Sitecore: reference item in other database ( source field )


c#,sitecore
I'm using Sitecore 8 Update 2. I've added extra fields to the user profile and have some static items that i would like to use to fill up droplist fields. The template for the user profiles however is in the core database and the items i want to use to...

Sitecore “personalize” button access for non Admin users


permissions,sitecore,personalization
Our CMS content editors are not configured as Sitecore Admin users. The content editors don't have access to the "Personalize" button in the Device editor. The users are added to a custom sitecore role which are inherited from these Sitecore roles : Sitecore\Designer Sitecore\Author Sitecore\Sitecore Client Authoring Is there any...

Sitecore Wrong Media File Path


sitecore,media-library
When I add an image through Media Library in RichTextEditor, the image path will be like this, <img src="~/media/A9DCE5769ED7445CA76F984FAF63A7D7.ashx?la=en" /> However, when I publish page item with this image, the image doesn't appear in Live. If I manually put slash ("/") in front of path, it works. <img src="/~/media/A9DCE5769ED7445CA76F984FAF63A7D7.ashx?la=en" />...

Sitecore Multiple nodes for rendering datasource


c#,xpath,sitecore,rendering,sitecore7.2
I am using Sitecore 7.2(rev. 140228), I have multiple sites & all of them have their own content store or meta-data. Now I wants to give them choice to select datasource either from own meta-data of other site. Although I know another option to make meta-data global outside of all...

301 Redirect Regex Pattern - Sitecore Redirect module


regex,redirect,sitecore,url-redirection
I apologize if this seems like a rudimentary question, but I'm trying to setup a redirect pattern for the 301 module in Sitecore and am having a hard time with the proper pattern. I need to have the following path: http://www.example.com/some-path/videos/2014/08/08/15/20/some-item-title converted to: http://www.example.com/some-path/videos/some-item-title Basically strip the numerical folders out....

Sitecore ECM: User unsubscribing newsletter receives no confirmation email


email,sitecore,unsubscribe,confirmation-email,sitecore-ecm
My unsubscribe-link does not work properly. The user IS moved from Opt-in into Opt-out, but receives no confirmation email. Do I have to do anything to make that happen? Note that I have not altered anything in /sitecore/content/ECM/[MyTarget Audience]/Standard Messages/Self-Service Subscription/Unsubscribe Notification. In my footer I link to a existing...

Trouble With Sitecore Web.config Patch File


sitecore
I am trying to "patch" a Sitecore web.config but am getting confused at how to add new items to the file. The file below loads fine until it gets to the httpErrors line. There, I get: System.Xml.XmlException: 'Element' is an invalid XmlNodeType. <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/"> <sitecore> <settings> <setting name="DisableBrowserCaching"> <patch:attribute...

Sitecore: The layout for the requested document was not found


sitecore,sitecore7
Only when I go to preview an item from the Content editor I get an error message The layout for the requested document was not found. I get redirected to http:///?item=%2f&layout=%7b00000000-0000-0000-0000-000000000000%7d&device=Default However, if I take the url and type it in directly or cut and paste like http:///?sc_itemid=%7BDA4BABB2-2605-46C5-8BA6-52215A826154%7D&sc_mode=preview&sc_lang=en Preview works....

Sitecore 6.6 - Setting up a Lucene index


lucene,sitecore,sitecore6
I'm working on learning how to setup and configure a Lucene search index for Sitecore 6.6. I've pieced together a base config file that indexes all items that are of type "Article" template starting at my desired location in the tree and am able to pull all the items out...

How can access sublayout control from another sublayout in Sitecore?


asp.net,sitecore
I have master layout and three sublayout header, content, footer. In header sublayout I have search textbox and search button, On click of search button result will display on content sublayout, On content sublayout I have repeater but I am not able to access repeater control in header sublayout. ...

How can I cancel a running Sitecore Job?


sitecore
How can I cancel a running Sitecore Job? There doesn't seem to be a method for this other than JobManager.RemoveJob(), and that doesn't seem to do anything other than remove it from the list of actively running jobs. It doesn't seem to actively cancel anything. Am I missing something here?...

Missing InstanceContext when upgrading from Glass.Mapper.Sitecore to Glass.Mapper.Sc


c#,sitecore,glass-mapper
I'm upgrading a project from Glass Mapper v2 (Glass.Mapper.Sitecore) to v4 (Glass.Mapper.Sc) and I ran into an issue where our solution was using the InstanceContext object to get classes by template Id. I couldn't find that InstanceObject or a similar class in the new Glass Mapper. Here's a snippet of...

uCommerce Product Appears on Sitecore site without publishing


sitecore,sitecore8
Just started doing some development with uCommerce and Sitecore but the way products start to appear on a site seems odd. In the Avenue Clothing demo site if you create a new product within the uCommerce admin it immediately starts to appear in the product listings, but if you click...

Searching empty date fields in index


sitecore,sitecore8
Somewhere between Sitecore 7.2 and 8.0 the logic for how empty date fields (i.e. date fields for which the content editor has not selected a value) are stored changed. They used to be be stored as DateTime.MinValue (i.e. 00010101); however, now they are stored as an empty string. Under Sitecore...

Sitecore Content Editor - Adds Styling


c#,html,css,sitecore
Whenever a picture is edited (Even if no height or width has been touched) then it adds: style="height: 123px; width: 123px;" Before edit: <p><img alt="" height="123" width="123" src="~/media/123" /></p> After edit: <p><img alt="" src="~/media/123;h=123&amp;w=123" style="height: 123px; width: 123px;" /></p> The problem is that the style height and width added by...

Sitecore installation wizard freeze


installation,sitecore,wizard
I need to install a package on my sitecore instance but for some reason when I click on upload button in the Intallation wizard the whole UI greys out and I can't even upload my package. Its blocking me from moving forward...

Update the standard font style for the /ja-jp/ website to Microsoft's Meiryo font


javascript,html,css,fonts,sitecore
In my sitecore website there is some enhancement requested from client. They want me to update the standard font style for the /ja-jp/ website to Microsoft's Meiryo font. This includes updating all HTML-based stylesheets related to all templates and sublayouts. I have limited time so want to start with best...

Glass.Mapper.Sc set inferType to true by default globally


c#,sitecore,glass-mapper
In Glass.Mapper.Sc v 4.0.1.5 ISitecoreService and ISitecoreContext have all their method signatures with inferType default to false. I'm looking for a way to override that and default to true without changing the method calls all over the site. I created another interface to override those just to modify the inferType...

MVC Validation on Subviews


asp.net-mvc-5,sitecore8
I am working on a Sitecore/MVC application, my first MVC application so I am learning as I go. No doubt I am going wrong somewhere along the line. I have a Basket that has 2 address views on it, one for billing and another for delivery. There is also a...

Sitecore sc:image tag produces a URL that gives a 404


iis,sitecore
I'm using an sc:image field renderer tag in Sitecore and when that field gets generated it produces this tag in the front end: <img src="/~/media/81907AC0172D4B93B5DF05E47B625F09.png" class="homepage_circle_icons" alt="Attract Customers" width="66" height="60"> In the url, it has .png at the end. On my localhost, this works perfectly, but when I deploy to...

Limiting Bucket Search using QueryBuilder field type in Sitecore


sitecore,query-builder,buckets,sitecore8
In our Sitecore application, we have a template called NewsArticleSlide which renders a news article on a carousel slide. This template has a field called "News article" which contains the ID of the news article being rendered. The type of this field up to now has been droplink, which has...

Difference between Sitecore solr index rebuild and refresh


indexing,solr,sitecore,sitecore7.2
we would like to know what is the difference between Sitecore full index rebuild and index refresh. When we want to refresh item in index it took ~2 min. Full rebuild of master index took ~10min. Why index refresh is so time consuming? We are refreshing item using this code:...

Sitecore - Require login


asp.net,sitecore
So for my Sitecore site I am trying to make it so the user is logged in and can not use the extranet\Annoymous account. I have read and tried Implementing Sitecore Extranet login on a website But I missed something, the asp forms authentication has side issues that it returns...

Sitecore 6.6 Item Buckets Module: Inactive Bucket Button


sitecore,sitecore6,bucket
I have Sitecore 6.6 with SIP 3.2 running and want to use Item Buckets (updating to Sitecore 7 doesn't work for us in this case). So I installed (the Module) and got the new menus icons to show in Sitecore. The problem is that when I select an item in...

Sitecore WFFM checkbox values on Create Item


sitecore
I'm using the Create Item save action in a web form. I have a checkbox list that points to a folder containing category items. This is mapped to a Multilist field on the item template that it will create when the user submits the form. But it's passing the checkbox...

Bundling with sitecore MVC


sitecore,sitecore-mvc,sitecore8
I implemented the code here: http://jockstothecore.com/bundling-with-sitecore-mvc/comment-page-1/#comment-6521 It is working perfectly. I just have a few questions. I want to know if there is a performance penalty in the code above since the code is using Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters. When does the InitializeGlobalFilters triggered? Is it triggered every time the page loads? Or...

Lost uCommerce interface within Sitecore


c#,sitecore8,umbraco-ucommerce
I am developing a web application using SiteCore 8 and uCommerce. To configure uCommerce I go through Sitecore and load the uCommerce interface. This morning I tried to load the uCommerce interface in the normal way, i.e logged into Sitecore and loaded uCommerce, but got nothing more than a white...

Sitecore: efficient way to use LINQ to compare against an ID


c#,linq,sitecore,glass-mapper
I have a LINQ query retrieving a list of , such as this: var results = SearchContext.GetQueryable<Person>() .Where(i => i.Enabled) .Where(i => i.TemplateName == "Person") .Random(6); Each object of type "Person" has a "Location" field which is also a Glass mapped item, and hence has an ID; I would like...

Get the all the childrens from Sitecore item in a parent child relation


sitecore
The following code will return all the childrens and SubChildrens in a list. But it's not keeping the ordering of Parent/Child relation. It will first return all the Parents Items and then all the child Items. Is it possible some how to keep the items in order and get them...

WFFM Overriding the FormID chosen in the Presentation Details


sitecore,web-forms-for-marketers
In a certain scenario I need to programmatically change the WFFM Form presented in the Form Renderer. The Form Renderer itself is added to a Placeholder via the Presentation Details. I am able to access the Form Render and set the FormID and update its parameters to the ID of...

Correct Place To Specify A Site's Caching Parameters In Sitecore?


sitecore,sitecore8
An "out-of-the-box" installation of Sitecore creates the following lines in the web.config file: <sites> <site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell" rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" loginPage="/sitecore/login" content="master" contentStartItem="/Home" enableWorkflow="true" enableAnalytics="false" analyticsDefinitions="content" xmlControlPage="/sitecore/shell/default.aspx" browserTitle="Sitecore" htmlCacheSize="10MB"...

Glass Mapper V4 Language Item Fallback


sitecore,glass-mapper
I am using Glass Mapper v4 with Autofac and cant figure out how to make it work with the Language Item Fall back module. There are examples of creating a class that implements IObjectConstructionTask (see below) public class FallbackCheckTask : IObjectConstructionTask { public void Execute(ObjectConstructionArgs args) { if (args.Result ==...