19

The issue here turned out to be the Sitecore.Services.SecurityPolicy setting. By default it only allows local requests to the API and as I have more servers in the mix and a load balancer on Staging I needed to allow remote requests with a patch file like so: <settings> <setting name="Sitecore.Services.SecurityPolicy"> <patch:...


15

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: ​Sitecore.Services.Client prevents using Attribute Routing with ASP.NET WebAPI​. Sitecore is calling the config.MapHttpAttributeRoutes() from Sitecore.Services....


10

Yes, it is possible to achieve your architecture using Sitecore. There are a few options for you here to do headless implementations, each with their own advantages and disadvantages, and different version/licensing implications. JSS (jss.sitecore.net): Currently in Tech Preview, this requires Sitecore 9 and a subscription/consumption license (as mentioned ...


8

This is a tricky question to answer as what is "best" can often depend on your solution. So let's look at the options: Item Web API - as @sitecorebasics said, the Item Web API is not supported in later versions of Sitecore, so even if you are on a version that it supports, I would not use it as it will make upgrades harder. Sitecore Services Client - This ...


6

Assuming you have xDB enabled you could perhaps use MongoDB to store your data instead. There look to be a few approaches for doing this: 1) custom page events: This looks like your best bet, Here are Sitecore's official docs for this: https://doc.sitecore.net/sitecore_experience_platform/developing/marketing_operations/events/...


6

Item Web API For Sitecore versions from 6+ till 8 you should use the Sitecore Item Web API. Documentation is available here: link Creating an Item from a Template To create an item called MyItem that is based on the Sample Item template in the master database, use a URL in the following format: http:///- /item/v1/sitecore/Content/Home?...


6

In my point of view, JSS is pretty suite for your requirements. I've implemented something like you want with Xamarin. But I think it doesn't matter with which technology to do that because I didn't use any Xamarin Sitecore specific frameworks or tools. I only send simple HTTP requests to LayoutService. If user accessing the different-2 pages from mobile ...


4

The pure HTTP GET request to your ProductController, assuming it was registered by the aggregate descriptor as being part of the custom service, should look something like: GET /sitecore/api/ssc/aggregate/custom/Products HTTP/1.1 Host: test.site Accept: application/json; Via cUrl you would be able to request your Products: curl -X GET -H "Accept: ...


4

This will be the way the routes get registered when applied by attributes. The correct way to register your own routes with Sitecore is to write a custom initialize pipeline processor and patch it in before the Sitecore InitializeRoutes processor. Take this example from the Habitat project: public class RegisterWebApiRoutes { public void Process(...


4

Below are different security policies for the Sitecore services. These were mentioned in "Sitecore.Services.Client.config". In order to make your services accessible remotely we would need to set Option #3 mentioned below. Option #2 is the default one. Sitecore.Services.Infrastructure.Web.Http.Security.ServicesOffPolicy: Policy denies access to all Entity ...


4

Tried a reboot? Sounds like it is in a deletion state and a reboot will clear it. When you delete a service and it is in state that cannot be removed, it flags it as "To be removed". And it is not until the next reboot that the cleanup job runs to delete the service. I like to stop the service and run sc.exe delete [<ServiceName>] in PowerShell. ...


3

Since you say you were thinking of requiring the use of the auth/login endpoint before requests can be made to your custom controller, what you can do is add the Authorize filter as an attribute to the controller or specific actions like this: [Authorize] public class ExampleController : ServicesApiController { public ActionResult Index() { ...


3

With WebAPI you may define your custom controller routes using Route attribute. The controller below excludes the /sitecore prefix from the URL and accessible as <hostname>/api/my: [RoutePrefix("api/my")] public class MyController : ServicesApiController { [HttpGet] [Route] public string Get() { return DateTime.Now.ToString(); ...


3

You don't need to reference any Sitecore dlls in order to be able to use the Sitecore REST API. These APIs are defined in the developer's guide available on SDN. (This document does not seem to have been ported to doc.sitecore.net yet, so SDN is where you need to get it.) Referencing Sitecore.Services.Core will give you access to a .NET API, so you aren't ...


3

As per the Sitecore Nuget feed, https://sitecore.myget.org/feed/sc-packages/package/nuget/Sitecore.Services.Client, these are the required assemblies/frameworks needed by the Sitecore.Services.Client assembly: .NET Framework 4.5 (or higher depending on the Sitecore version being used) Sitecore.Kernel Sitecore.Services.Core Microsoft.Extensions....


3

You can also use the Sitecore ItemService API to do this like so: var xhr = new XMLHttpRequest(); xhr.open("POST", "http://<your server>/sitecore/api/ssc/item/sitecore%2Fcontent%2Fhome "); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onreadystatechange = function () { if (this.readyState == 4) { alert('Status: '+this.status+'\...


3

This seems to be undocumented feature of Xdb. I couldn't find any reference in the documentation when you should use this page. Based on what's written in comment in App_Config\Sitecore\Marketing.xDB\Sitecore.Xdb.config for setting with name XdbDisabledUrl, this page should be used when (obviously) Xdb is disabled. All applications that depend on the Xdb ...


3

It’s a bit hard to know what’s going on without seeing your code and config and knowing your Sitecore version but some things to check are: Login Cookies Are you getting the login cookies from the login endpoint and passing the login cookies in your request to the API? Here is an example of a get item request. The login cookies are created by a separate ...


3

It is not possible to get any information from the Link Database using Sitecore Services Client (ItemService). As the documentation states ( https://doc.sitecore.com/developers/93/sitecore-experience-manager/en/the-itemservice.html ): The ItemService provides a single HTTP endpoint and an API that you use to interact with Sitecore items over HTTP. You ...


2

You can use sitecore Sitecore Item Web API to create an item. http://[host_name]/-/item/v1/sitecore/Content/Home?name=MyItem&template=Sample/Sample Item&sc_database=master Also make sure you have these settings in your Sitecore.ItemWebApi.config itemwebapi.mode="StandardSecurity" itemwebapi.allowanonymousaccess="false"/> For more info https://...


2

A client (e.g. your browser) can indicate to the webserver the characteristics of the data it will accept back from the webserver. This is done using 'accept headers' of the following types: Accept: The MIME types accepted by the client. For example, a browser may only accept back types of data (HTML files, GIF files etc.) it knows how to process. Accept-...


2

As I see it, your options are: Change the routing setup to remove the /sitecore part from the expected route information. Not knowing your code, this could have side effects and would need a thorough regression test. Using your Load Balancer (LB) or Url Rewrite rules, you can rewrite the public Url to remove the /sitecore part, and then route that from the ...


2

TL;DR The SigningTokenProvider is instantiated in the constructors of the Sitecore.Services.Infrastructure.Sitecore.Security.TokenDelegatingHandler (which you discovered and shared with me offline). The type used for the TokenDelegatingHandler is set in the api/services/configuration/delegatingHandlers node list in the config, which means that you can add a ...


2

One option is to used Analytics Database Manager You have to use Analytics Database Manager 2.1 This version works with: Sitecore CMS 6.5 - 7.2 These module it helps you to run next tasks : Clean all Analytics data Clean Analytics data by the specified criteria Remove all BOTs visitors Rebuild index I recommend you to not run on live environment, make ...


2

If your question is what is the best approach to allow external resources to interact with Sitecore, and not about how to create a web service: I wouldn't re-invent the wheel. If you just need to expose Sitecore's functionality, just use Sitecore's functionality. Sitecore already exposes its API with CRUD operations, including search: For the requirements ...


2

For most load balancers it is indeed the following case sensitive setting: <setting name="Analytics.ForwardedRequestHttpHeader" value="X-Forwarded-For" /> However, you may want to check with your particular load balancer as sometimes they vary.


2

You can still create web services using Azure Platform Services, including: Azure Functions with HTTP Trigger will enable you to make external Web service calls and Functions can then make API calls to Sitecore. Use API Gateway to enable metered and secured access if you have multiple clients that require tracking and throttling of usage. Or Azure API Apps ...


2

To add more to Artsem's answer and to answer the additional questions that were not answered. If we wanted to provide data (get/set operations on content tree, analytics, personalization, tracking data) from Sitecore 9 to native mobile apps ... , in this case Sitecore 9 item web service and XConnect can be utilized or XConnect with JSS can be ...


2

We need to provide access rights to sitecore\ServicesAPI user. I was fixed that error by setting admin rights to sitecore\ServicesAPI user in usermanger.


2

I solved it by using the below code in web.config <httpProtocol> <customHeaders> <add name="Access-Control-Expose-Headers" value="*"/> <remove name="X-Powered-By" /> </customHeaders> </httpProtocol>


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