Questions tagged [webapi]

For questions related to the ASP.NET Web API framework, whether writing APIs to manage content or functionality in Sitecore, or consuming data from APIs written using Web API (e.g., the Sitecore ItemService).

Filter by
Sorted by
Tagged with
0 votes
0 answers
67 views

Error - The requested resource does not support http method 'GET'

The following error is displayed when trying to load from database: The requested resource does not support http method 'GET' And this is content of webapiconfig file: using System; using System....
0 votes
1 answer
186 views

Sitecore services client 403 when login called from different web application

TL;DR: Sitecore services client 403 when login called from different web application (IIS process), but not when called from Postman PROBLEM: RESTful Web API (web service) written in C# running on IIS/...
  • 101
0 votes
1 answer
42 views

Post an XML to a webservice with the sitecore form fields

I am working on an application where I created a form using sitecore forms. When the user submits the form, It should read all the fields from the forms and add it to XML element and post the XML ...
  • 1
0 votes
0 answers
18 views

Sitecore And Web Service on Same Hostname not working [duplicate]

We have a Sitecore instance with a domain - abc.com and a Custom WebService is created which is also using the same domain as abc.com/internalservice.asmx, upon calling this service from Sitecore ...
0 votes
0 answers
18 views

Path-analyzer showing the Web API request [duplicate]

Sitecore : 9.1 + JSS 11.0 Integrated mode What we have: We have written certain APIs in our Sitecore solution. The front-end code access those APIs on the page-load. In the Path-analyzer, we see the ...
  • 1,168
0 votes
0 answers
71 views

Connect Sitecore to External source for data authoring

We have an external data source (SQL or via API). That data needs to be managed by our content authors. i am looking at something this can be done by tool or minimal customization. I tried to create ...
0 votes
1 answer
146 views

Can I start PowerShell background job through PowerShell Web API endpoint?

I have a PowerShell Web API endpoint running on Azure that takes more than the maximum duration of 230 seconds on an Azure Web App. Is it possible to start a background job consisting of PowerShell ...
-1 votes
2 answers
341 views

How to get the Item referrers using Item Web API / Sitecore Services Client in C#? [duplicate]

I have created Items using Item Web API. Now I want to get the unused items on my site. So I'm trying to get the item references using Item Web API. var referrers = Globals.LinkDatabase.GetReferrers(...
  • 652
2 votes
1 answer
763 views

Sitecore 9.2 Dependency Injection in ApiController

I have a standard .net ApiController with the following code: public class LibraryApiController : ApiController { private readonly ILibraryAssetRepository _repository; public ...
  • 844
1 vote
1 answer
468 views

Html.Sitecore().Rendering() causes: Attempt to retrieve context object of type 'System.Web.Mvc.ViewContext' from empty stack

We have a web controller inside our Sitecore 8.2 Site that returns a search box view. The controller is exposed as an API endpoint like so: {url}/api/search/large/ When making an http web request to ...
1 vote
3 answers
1k views

Getting 404 error with custom Web API [duplicate]

We have Sitecore 9.0 update 2 site running on Windows Server 2016. We've added a custom web api controller. We are able to successfully request the custom web api methods on our local environment ...
  • 51
0 votes
1 answer
159 views

Using .net core web api from sitecore root

We are building JSS application in SSR mode. We need to build an api which will be running from sitecore root. Can I build API using .net core or only .net framework is supported when running it from ...
9 votes
3 answers
2k views

Exposing ServiceApiController in Sitecore 9.2

I am trying to expose a MVC route in Sitecore 9.2 for a web api I am creating. I followed the steps describe here but it only works when my controller inherits from controller. If I inherit it to ...
  • 175
1 vote
0 answers
307 views

Sitecore JSS component invoking a web api

I had a react js application (http://localhost:3000) that invoked a web API (http://xyz) POST method. The way I accomplished that is - through the "proxy": "http://xyz" setting in ...
  • 11
1 vote
3 answers
2k views

/api/sitecore is not working in CD server

Sitecore Version: 9.0.2 Environment: Azure PaaS CD We are trying to call /api/sitecore/controller/actionname with AJAX. It's working on the CM server but not on the CD server. I disabled custom ...
0 votes
1 answer
418 views

Prevent Login Redirect on 403 When an Ajax Call

Using Sitecore 9.1 and SXA 1.8 Does anyone know the best way to force Sitecore to return a legit 403 error when an Ajax call is hitting an API method? Currently when the following code is thrown ...
  • 311
1 vote
1 answer
1k views

Sitecore custom api routing is not working

We have a multi-site environment. In one of the module, we are calling the same controller/action from all the sites. Perhaps, the same Javascript file which calls this controller/action is ...
  • 159
1 vote
1 answer
1k views

JWT tokens for authentication for 9.0 UPDATE 1

I have an instance running SxC 9.0 update 1. I was working on an API which had to be consumed by a 3rd party application. Can you provide some input for using token bear mechanism to protect my API. ...
1 vote
3 answers
10k views

How to Return 401 Response from OnAuthorization Method - ServicesApiController

I am exposing web API through ServicesApiController and want to authorize user through [AuthorizedUser(@"sitecore\ServicesAPI")] attribute of the function, everything is working fine, but instead of ...
0 votes
1 answer
961 views

Yet another "The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called" question

I am on Sitecore 9.1. I have read this question and this other one; my configuration is as follows. In order to execute my code on startup, I hijack the initialize pipeline: <pipelines> <...
1 vote
0 answers
2k views

jQuery AJAX GET request returning “parsererror” error response message

In a scope of Sitecore Web project an API Contoller is used. Got the following response error message during jQuery AJAX GET API request: On a back-end side I use IHttpActionResult action method that ...
1 vote
2 answers
203 views

RESTful API for getting incremental changes?

I would like to call an API to Sitecore to get changes of Media Library files stored in Sitecore. So given a Media Library, I would like to list the New Files, Updated Files and Deleted files since a ...
2 votes
2 answers
210 views

Custom facet data not being updated after initial flush to xDB

What i want to do: Save and update facet data repeatedly through WebApi Read the facet data through WebApi Everything works fine, until the contact stops being updated. It seems as if, once the ...
1 vote
1 answer
264 views

ServicesApiController in referenced project/DLL

I'm trying to create some web APIs in a new class library outside of my main website project (still in the same solution). In this library I've added the following API Controller: namespace My.Custom....
1 vote
1 answer
2k views

How to use Authenticated request with the Sitecore RESTful API

As explained in the official Sitecore documentation, I'm using the following block of code to login into the Sitecore. module.exports = function (context, req) { var XMLHttpRequest = require("...
  • 289
1 vote
1 answer
6k views

Sitecore WebApi custom route not working controller not found

Controller: public class ExampleController : Controller { private readonly ISitecoreContext _sitecoreContext; public ExampleController () { } [System.Web.Http....
  • 397
1 vote
2 answers
1k views

loading partial view from jquery

I am trying to swap partial views on my home page layout via jquery. I have 3 tabs which when clicked, would load their respective partial view into a placeholder on the main layout. In my ...
  • 159
0 votes
1 answer
232 views

'Unable to connect to SQL Server database.' - webAPI

using: VS-2017(as admin), sitecore-8.1.2 and SQL - 2012. I created a ASP.Net web application - WebAPI to read content from my local sitecore instance. In the "ValuesController.cs" I am using the ...
  • 67
2 votes
1 answer
968 views

Sitecore JSS integrated mode with subsites

I have created separate bindings for the basic and advanced sample JSS apps as outlined in https://jss.sitecore.net/#/setup/sitecore-config?id=sitecore-configuration 127.0.0.1 JssBasicApp 127.0....
  • 543
7 votes
3 answers
5k views

WebAPI Controllers not being found

I'm working in a Helix-ish solution on Sitecore 8.2. I can't seem to register any WebAPI controllers. The routes are fine. I've dug pretty far into the GlobalConfiguration and determined that it's ...
  • 1,307
4 votes
1 answer
689 views

Get user privileges on item via Sitecore RESTful API

I am looking for a good way to figure out what privileges a user has via the Sitecore RESTful API. For example, I can use the RESTful API for ItemService: /sitecore/api/ssc/item/{itemId}?fields=...
  • 165
0 votes
2 answers
265 views

Migrating content from sitecore 7.2

So we need to migrate content from sitecore 7.2 to sitecore 8. But it's not only migrating, we also need to modify the content in order to have updated content in the new instance. Our original ...
0 votes
1 answer
706 views

Can I use Sitecore Item Web API to insert items into bucket list from different application

I am in the need to expose a restful api which eventually will insert items to bucket list available in sitecore. This api will be cosnumed by another MVC application to push records into sitecore ...
  • 149
2 votes
1 answer
3k views

Sitecore webapi No HTTP resource was found that matches the request URI (404)

I would like to add some web api to my project but I am getting error that No HTTP resource was found that matches the request URI What I could miss in settings or how I can see all sitecore routs ...
1 vote
5 answers
8k views

Web Api controller returning 404 despite returning payload

I have created a WebApi controller, and it's returning the payload OK (i.e. I see the correct response in the browser), however the status of the request is a 404, which obviously causes problems with ...
0 votes
1 answer
183 views

Custom web api returns dynamic links for rich text field if logged in to sitecore

I have created a custom web api which converts glass object to json string. The glass object involves rich text field where internal links can be used. The link is fully rendered to absolute path in ...
  • 81
4 votes
3 answers
3k views

ServiceApiController Method not found when using HttpPost and ComplexType (Sitecore 8.1.3)

I am working on refactoring some code and want to create WebApi services to do so. I have created an initialization pipeline that registers custom routes. I am still able to follow base sitecore ssc ...
6 votes
1 answer
114 views

Do we have an API for sitecore 6.6

I want to acess the sitecore items from outside context . Do we have an API to acess Sitecore Items in Sitecore 6.6?
  • 1,059
3 votes
2 answers
1k views

Web API 404 on content delivery server

I am using Sitecore on azure and have a CD and a CM server. The Web API works fine on CM but throws a 404 error (and no more information in logs). I have deleted the following dll files from server ...
0 votes
1 answer
556 views

Create users from API

We are trying to build a stand-alone API, which has to meet this requirement. The API gets inputs for "Name" & "Email" and should then create user in any chosen Sitecore instance. As this is a ...
  • 2,535
6 votes
1 answer
2k views

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

In sitecore 7.2 I had customized sitecore web api to expose data from sitecore to external system as API. I am just wondering if something new/enhanced has been added in sitecore 8.2 to expose data ...
2 votes
1 answer
772 views

Does implementing a WebApi service using ServicesApiController expose a significant security risk?

I have been following Anders Laub's tutorials on implementing some WebAPI controllers using ServicesApiController and just like at the bottom of this page I received the 403 Forbidden error when ...
  • 617
1 vote
2 answers
516 views

Run serialize command from outside the Sitecore as a service

So I am faced with a challenge. I need to create a REST Services that will allow me to serialize Sitecore tree from outside the Sitecore. Is there some kind of service like this in place? Or this need ...
  • 539
0 votes
2 answers
845 views

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

So I have a list of items (e.g. FAQs). and I am calling them through the WEB Api. I want to be able to do a get from Sitecore and be able to sort based on the date created and sort it either ascending ...
  • 539
8 votes
1 answer
3k views

WebAPI Attribute Routing Not Picking Up Routes

Sitecore 8.2 rev 160729 My understanding is that, as of Sitecore 8.2, you no longer need to call .MapHttpAttributeRoutes() because it's now included (in fact, it'll throw an error if you do). However, ...
  • 1,307
7 votes
2 answers
3k views

Sitecore 8.2 with Web API 2

Does anybody have any experience with Web API and Sitecore? I've got a custom database for data not managed by Sitecore, but will be presented alongside Sitecore data. The API calls work fine when ...
  • 617
3 votes
1 answer
1k views

publish item remotely using c#

For testing purposes we would like to create publish and remove some items in Sitecore using a remote testing- client in C#. Sitecore.Services.Client api seems the most logical way to create and ...
  • 366
4 votes
0 answers
719 views

UseTaskFriendlySynchronizationContext in WebApi calls

I'm trying to use Async tasks in my custom web api calls in Sitecore. I've successfully followed this article http://www.agehrke.com/2015/08/web-api-controller-in-sitecore-8/#comment-18861. However I'...
4 votes
4 answers
731 views

Executing Sitecore logic from a Windows Scheduled Task

One of the frequent problems that I have seen with Sitecore is the inability to control the exact time that a scheduled task should run. Since the machine's clock will be far more accurate, what I ...
11 votes
4 answers
21k views

WebApi failing to resolve dependencies

I am trying to resolve an implementation via constructor injection, however keep getting the following: An error occurred when trying to create a controller of type 'ApiController'. Make sure that ...
  • 1,409