Hot answers tagged

15 votes
Accepted

Web API 2 Attribute Routing with Sitecore 8.2+

This should actually now work out of the box on Sitecore 8.2+ including Sitecore 9 and 10 with no additional code or configuration required. Among the resolved issues from the 8.2 release notes: ​...
Søren Kruse's user avatar
  • 3,245
15 votes
Accepted

WebAPI Controllers not being found

Web API is apparently really aggressive when it caches API Controller types. I was able to fix my issue by doing the following: stop IIS kill the w3wps navigate to C:\Windows\Microsoft.NET\...
Ben Lipson's user avatar
  • 1,362
14 votes
Accepted

Exposing ServiceApiController in Sitecore 9.2

You have most of the pieces you need, but not all. You need a patch config <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <initialize> ...
Mark Cassidy's user avatar
10 votes
Accepted

How can I utilise MongoDB for non-xDB related things in my Sitecore solution?

Utilizing data extension points The first thing I would consider is whether your data can be stored as part of the standard Sitecore entities. Contact The xDB contact has the following fields where ...
Dmytro Shevchenko's user avatar
9 votes
Accepted

JWT tokens for authentication for 9.0 UPDATE 1

You can implement custom DelegatingHandler base on Sitecore.Services behavior: using System.Linq; using System.Net.Http; using System.Security.Claims; using System.Threading; using System.Threading....
x3mxray's user avatar
  • 3,140
8 votes
Accepted

WebApi failing to resolve dependencies

The issue is where you're initializing the Web API DependencyResolver in the Sitecore initialize pipeline. In Sitecore 8.2, the part of the initialize pipeline where the MVC and Web API ...
Corey Smith's user avatar
  • 2,708
8 votes
Accepted

Migrating content from sitecore 7.2

There are a number of approaches people have taken to accomplish such a task. One of my preferences is to use the Sitecore PowerShell Extensions (SPE) module. With some knowledge of PowerShell, you ...
Michael West's user avatar
7 votes
Accepted

Best way to expose sitecore data to external system as web api

You can use Sitecore Client Services to expose data from Sitecore Sitecore.Services.Client provides a service layer on both the server and the client side of Sitecore applications that you use to ...
Vlad Iobagiu's user avatar
  • 18.2k
5 votes

Sitecore 8.2 with Web API 2

I think you need to move the stuff in your WebApiApplication.Application_Start method to the initialize pipeline like you are doing with the RegisterRoutes class. In Sitecore 8.2 (or somewhere around ...
Søren Kruse's user avatar
  • 3,245
5 votes

Executing Sitecore logic from a Windows Scheduled Task

Here is a low complexity example using Sitecore PowerShell Extensions. Make sure that the SPE Remoting Module files are saved to a path configured in $env:PSModulePath. Save script to desired path: ...
Michael West's user avatar
5 votes

"String was not recognized as a valid DateTime" error

The issue may be related to your other question where it appears that you have some invalid date formats. From the StackTrace it looks like the issue is related to one of the Media facets. I would try ...
Christian Hagelid's user avatar
5 votes

Do we have an API for sitecore 6.6

https://sdn.sitecore.net/Products/Sitecore%20Item%20Web%20API/SitecoreItemWebApi12.aspx Sitecore Item Web API 1.2. This version of the module only runs on Sitecore CMS 6.6.0 rev. 131211 (6.6.0 ...
Gatogordo's user avatar
  • 20k
5 votes
Accepted

/api/sitecore is not working in CD server

It was moved to SPEAK routes in Sitecore 9 and unavailable on CD server. You can resolve it by adding this snippet to your routing configuration (if you really need this API route - best practice is ...
x3mxray's user avatar
  • 3,140
5 votes

/api/sitecore is not working in CD server

The /sitecore/api route is a default route added by Sitecore in configs that are specific to the content management aspects of the platform. These configs are not enabled for content delivery. As ...
Dan Sinclair's user avatar
  • 5,335
4 votes
Accepted

Web API 404 on content delivery server

One option is to enable Sitecore.Speak.Mvc.Config file . In the Sitecore.Speak.Mvc.config file, the InitializeCommandRoute processor maps the /api/sitecore/{controller}/{action} route for SPEAK UI ...
Vlad Iobagiu's user avatar
  • 18.2k
4 votes

WebApi failing to resolve dependencies

Ran into this exact same issue but with Ninject instead. From what I could tell it was a conflict of resolution between WebAPI and MVC. Ultimately I was able to resolve the issue by implementing my ...
vandsh's user avatar
  • 1,651
4 votes
Accepted

Executing Sitecore logic from a Windows Scheduled Task

The built-in Sitecore scheduler can certainly be frustrating in its limitations. So using a WebApi endpoint that the task can call is certainly one way of doing things. You should keep security in ...
Matt's user avatar
  • 363
4 votes
Accepted

Get user privileges on item via Sitecore RESTful API

Sitecore security model does provide API for determining user access rights (see Sitecore.Security.AccessControl.ItemAccess class). AFAIK there is no any web service exposing it but you can easily ...
Serhii Shushliapin's user avatar
4 votes

Exposing ServiceApiController in Sitecore 9.2

MapRoute is meant for MVC controllers whereas MapHttpRoute is meant for Web API controllers. ServiceApiController is ApiController, and you should register your route with MapHttpRoute instead of ...
x3mxray's user avatar
  • 3,140
3 votes
Accepted

publish item remotely using c#

An easy option would be to create your own webapi controller and create an action that does the publish, using the Sitecore API: Sitecore.Publishing.PublishManager.PublishItem(...) You can pass the ...
Gatogordo's user avatar
  • 20k
3 votes

Run serialize command from outside the Sitecore as a service

Sitecore PowerShell Extensions - Web API As pointed out by Richard, SPE comes with some ways to do this. You can find more details about the latest version of SPE Remoting here. For now we will stick ...
Michael West's user avatar
3 votes
Accepted

Run serialize command from outside the Sitecore as a service

There isn't anything OOTB that will allow you to hit a rest service. You have a couple of options: Sitecore PowerShell Extensions You could use Sitecore PowerShell Extensions remoting to do that ...
Richard Seal's user avatar
  • 20k
3 votes

Sitecore 8.2 How to sort items based on a specific parameter within a content item

If the WEB Api returns the same order as items sorted in the content tree you can change it by: Select an item folder where all sub-items required to be sorted by some criteria. On the Home Ribbon ...
Vlad Shpak's user avatar
  • 1,792
3 votes

Sitecore 8.2 How to sort items based on a specific parameter within a content item

It's possible to extend although not entirely that easy because Sitecore uses a lot of dynamics instead of actually typing things when it comes to ItemWebApi. A small example (note that this kinda ...
Filip Verswijver's user avatar
3 votes

How do I control access to Custom Item Web API controllers?

There should be nothing related to debug mode, can you please check it again? If still same problem do below settings: Make a Log for security related stuffs or other variables in a processor before/...
Yogesh Patel's user avatar
  • 1,007
3 votes
Accepted

How do I control access to Custom Item Web API controllers?

So I had an issue with this custom Web API hosted inside my Sitecore solution, that will be used by a third party to call upon some Authentication and Authorization functionality. I did the following ...
Amin Sayed's user avatar
3 votes
Accepted

Sitecore JSS integrated mode with subsites

Could you please try the following solution? Add the following after line 10 in advanced-sample-react\src\dataProvider\DataProvider.prod.js: params.sc_site = 'jssadvancedapp'; For context: const ...
Alex Shyba's user avatar
3 votes
Accepted

Sitecore WebApi custom route not working controller not found

Your route pipeline definition should be changed to this one: public class RegisterTestApiRoute { public virtual void Process(PipelineArgs args) { RouteTable.Routes.MapRoute( ...
Peter Procházka's user avatar
2 votes

How do I control access to Custom Item Web API controllers?

By enabling CORS you are enabling Cross Origin Resource Sharing. You would need to supply the domains that would be allowed to call your endpoint. As you are not making a call from an external domain, ...
Bas Lijten's user avatar
  • 1,857
2 votes

WebAPI Attribute Routing Not Picking Up Routes

I think since you have a DI configured that will be resetting any routes registered after you've added them so you need to do this afterwards in the initialize Pipeline like so: Create a pipeline to ...
Adam Seabridge's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible