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
-1
votes
2answers
43 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(...
2
votes
1answer
163 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 ...
1
vote
1answer
115 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
3answers
240 views

Getting 404 error with custom Web API

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 ...
0
votes
1answer
98 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 ...
8
votes
3answers
517 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 ...
0
votes
1answer
116 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 the package.json of ...
1
vote
3answers
798 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
1answer
156 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 ...
1
vote
1answer
486 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 ...
1
vote
1answer
547 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
3answers
4k 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
1answer
446 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
0answers
667 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
2answers
154 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
2answers
162 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
1answer
202 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
1answer
1k 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("...
0
votes
1answer
4k views

Sitecore WebApi custom route not working controller not found

Controller: public class ExampleController : Controller { private readonly ISitecoreContext _sitecoreContext; public ExampleController () { } [System.Web.Http.HttpGet] ...
1
vote
2answers
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 ...
0
votes
1answer
174 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 ...
2
votes
1answer
688 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....
7
votes
3answers
2k views

WebAPI Controllers not being found in Sitecore 8.2

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 ...
4
votes
1answer
547 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=...
0
votes
2answers
216 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
1answer
633 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 ...
2
votes
1answer
2k 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
5answers
6k 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
1answer
106 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 ...
4
votes
3answers
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
1answer
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?
3
votes
2answers
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
1answer
438 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 ...
6
votes
1answer
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
1answer
708 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 ...
1
vote
2answers
384 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 ...
0
votes
2answers
745 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 ...
8
votes
1answer
2k 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, ...
6
votes
2answers
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 ...
3
votes
1answer
999 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 ...
4
votes
0answers
556 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
4answers
581 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
4answers
16k 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 ...
7
votes
2answers
631 views

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

Assuming we have a sparking new Sitecore installation running, and have already invested in the relevant MongoDB infrastructure to keep the solution running 24x7 and so on - how can I make further use ...
11
votes
1answer
2k views

Web API 2 Attribute Routing with Sitecore 8.2 Initial Release

Has anybody setup web api 2 attribute routing with 8.2 initial release? I tried the 'official' route, which is to create a custom pipeline handler to the initialize pipeline that does the registration....
3
votes
1answer
692 views

“String was not recognized as a valid DateTime” error

Images do not appear in Select Media dialog when I click Browse button in Image field. HTTP response from ItemWeb API that expected to return Images contains this error: String was not recognized ...
7
votes
3answers
2k views

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

I am creating a Web API (Controller) inside my Sitecore solution by inheriting ServicesApiController and EnableCors attribute. This service will be called from any IPhone/Android Application (...