Questions tagged [sitecore-api]

For questions related to Sitecore's API, covering questions about how to access, create, update or or delete data, as well as questions about how the Sitecore code-base is or can be used for custom or native logic, etc.

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

Sitecore SolrNet - The given key was not present in the dictionary error

We are using SolrNet open source client in Sitecore 9.0 update2 and SXA 1.7 version. We have written this code to get SolrConnection: Assert.ArgumentNotNull(searchcontext, "searchcontext"); var ...
3
votes
0answers
28 views

Restoring marketing taxonomies with Sitecore powershell extenstion

I am trying to automate Sitecore upgrade from 8.1 to 9.0.1. In Upgrade steps, There is one step restoring deleted marketing taxonomies, which can easily be done with Url navigation and click button on ...
3
votes
1answer
1k views

LinkManager.Provider is deprecated in Sitecore 9, how to get the default provider then?

The following code works in Sitecore 8.2 but not in Sitecore 9: var provider = LinkManager.Provider; The Provider property is not available anymore in Sitecore 9 Sitecore.Kernel, what should I use ...
1
vote
1answer
150 views

Error while saving SXA page from Experience Editor [closed]

I am trying to save the page after doing edits in SXA page from Experience editor and getting below error every time. This is occuring only for this page. In network tab, the response for ...
4
votes
1answer
575 views

Sitecore 9 in Azure PaaS : Add Application Insights SDK

For Sitecore 9 on Azure PaaS and newer versions, what is the best practice to Add and configure the Application Insights SDK in Visual Studio to generate some telemetry in Visual Studio. As we are ...
3
votes
1answer
319 views

Action methods in ServiceApiController is not catching the request

I'm using Sitecore 9 and I have created a ServiceApiController to enhance Sitecore API. I put a simple action method but it doesn't catch any request and I get this exception: Document not found - ...
7
votes
1answer
148 views

Is there a method in Sitecore's utilities to format a numerical file size in a friendly way?

The title pretty much says it all. I feel like I've come across a method in the past that does something like: long fileSize = 524288000; string prettyFileSize = Sitecore.SomeUtility....
0
votes
1answer
330 views

Unable to fetch item using getitem method

I was trying to access item using getitem method from SOAP service. Sitecore.Data.Items.Item item = Sitecore.context.Database.GetItem(<ID>) But Item is null. I tried to fetch using Id and path ...
0
votes
0answers
232 views

Programmatically move items from web to master database?

I have a utility page that creates Sitecore items from a csv file. This utility page is used to import thousands of items at a time, which are used for interactive map data. The items are stored in ...
1
vote
1answer
65 views

Get prefetch cache created status

Is there any way to understand the status of prefecth cache ? What i want to understand is that if the prefetch is already created or not ? When i disassemble the sitecore.kernal , I see a property ...
0
votes
1answer
503 views

User Profile table in SQL

I am saving a user profile and one of the field is "UserLanguage" which is saving fine Context.User.Profile.Save(); The save method is working as expected but where the User Profile being saved in ...
0
votes
1answer
80 views

WFFM custom toggle switch [closed]

I am adding toggle switch as a custom field. Toggle.cs (Toggle C# code) public class Toggle: Sitecore.Form.Web.UI.Controls.Checkbox { } public class ToggleField : Sitecore.Forms.Mvc....
2
votes
1answer
106 views

Fetching Final renderings in an .aspx page

I am creating a script to fetch rendering parameters of a sublayout and edit data template item field data based on the values of fields of rendering parameters. I was able to fetch renderings in ....
8
votes
2answers
275 views

What is alternative of “.PageMode.IsExperienceEditor” property in JSS-react?

What is alternative of .PageMode.IsExperienceEditor property of Sitecore.Context in JSS-react to verify the ExperienceEditor context ?
1
vote
1answer
998 views

Sitecore support for async controller renderings

I am planning to use ASP.NET async pattern in my Sitecore project, but I'm getting the error: Asynchronous method which returns task as result cannot be executed synchronously Is there a way to ...
4
votes
1answer
110 views

Content Item batch retrieval in .Net code?

Is there a way to retrieve a set of content items from Sitecore's APIs in batches, besides using the REST API? I'm looking at improving performance for a client's Sitecore site. A lot of the legacy ...
1
vote
1answer
407 views

Sitecore keywords in the metadata

Lets say we have 4 renderings on the Page and each rendering has a data source attached to it which has a Keyword field that is being used for SEO purpose. Is it possible to get all the attached ...
1
vote
1answer
278 views

How to add renderings programmatically when another rendering is added

Which pipeline should I use when a new rendering is added in the presentation? I have a scenario to add renderings programmatically if a particular rendering is added in the item. I will write a ...
0
votes
1answer
198 views

Sitecore 7.2 using droplink

I will start out by saying I am a bit of a noob when it comes to C# and Sitecore, but I am getting better. I am trying to update our code to use a droplink control for an event item (we'll call it ...
17
votes
3answers
3k views

What does headless mean in the context of Sitecore?

There have been numerous discussions around headless capabilities supported by the Sitecore platform. What does that even mean? What product offerings from Sitecore support headless capabilities? ...
1
vote
0answers
35 views

Not able to create a new SXA Accordian items in IE

I am trying to add a new SXA Accordian component from Experience editor in IE but not able to get 'Create' link which is working fine in Chrome. PFB Screenshots
1
vote
1answer
41 views

Creating an item with the API returns 201, but then I cannot find the item?

Note: I am using a trial instance of Sitecore 9.0.2. I create an item: curl -X POST \ https://mysitecoreurl/sitecore/api/ssc/item/%2Fsitecore%2Fcontent%2FHome%2Ffolder1 \ -H 'Content-Type: ...
0
votes
1answer
678 views

How to check Server side whether session is time out or not?

As I am new to Sitecore and working on session time out functionality in Sitecore. Instead of redirecting to login page I've to display session time out warning message to end user and How to validate ...
0
votes
0answers
49 views

“virtual” sites in the navigation tree

When I have have my navigation tree with page X and page Y and some content on page X and I need to show the same page X with the same content under an other content tree. E.g. page X under page Z. ...
1
vote
1answer
147 views

Experience Profile custom facet retrieval error

I was trying to create custom facets in Sitecore 9.0 Update 1. I was able to create one and add a custom tab in experience profile. I fill the custom facet data with the help of a WFFM form. I see the ...
2
votes
1answer
386 views

Updating droplink field value by name

I'm trying to update a droplink field value using its name but I get the following error: Value not in the selection list The code is item.Fields["__Subitems Sorting"].Value = sort; // sort ...
1
vote
2answers
149 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
1answer
312 views

What do I need to do to display an image on my web page using the ItemService API?

I've uploaded a few images of kittens, teddy bears, flowers, and other cute things to a folder within the Sitecore Media Library. I now need to access them using the ItemService API and display them ...
1
vote
2answers
438 views

Force saving of an item

I have several newly added save events for existing items. Any way to force a save of an item? When I do $item.Editing.BeginEdit() / $item.Editing.EndEdit() in PowerShell it returns false since ...
1
vote
2answers
212 views

Publish items using the JavaScript ItemService API

I'm using the ItemService API in Javascript to login to sitecore and dynamically create items (documentation i'm using) var xhr = new XMLHttpRequest(); xhr.open("POST", "http://<your server>/...
0
votes
1answer
387 views

How to integrate an external API with Catalog in Sitecore Commerce 9.0.2

I want to fetch the data from an external API and show it for my Catalog items. The API basically contains the details of my sellable items like product price, name and other details which properties ...
1
vote
1answer
497 views

How can I add custom catalog attributes in Sitecore Experience commerce 9 and populate it with data from API?

I want to add new attributes for my catalog in Sitecore Experience Commerce 9 update 2 but not sure how to add it using the Sitecore Experience platform. Moreover all the properties data need to be ...
5
votes
1answer
264 views

What is the ShutdownGuard and how should I use it?

I heard someone mention the use of ShutdownGuard for long running precesses. How does one properly make use of this and what are some cautions around its usage?
1
vote
1answer
515 views

Import Media Items in Sitecore Media Library ItemService Restfull API

We are implementing a solution that requires importing media items like images inside Sitecore Media Library. Found it is achievable with Old WebApi, however nothing mentioned equivalent in Sitecore ...
1
vote
0answers
220 views

Can't create contact list

I couldn't create contacts list and getting following exception, HTTP POST URL http://x/sitecore/api/ssc/ListManagement/ContactList Exception Sitecore.XConnect.XdbSearchUnavailableException: The ...
0
votes
1answer
146 views

How to make Sitecore.Context.Item.Fields work in a web control in an external project

I have a Web Forms page and it uses Sitecore.Context.Item.Fields. This works when I publish to the local Sitecore instance. But in my project that is external to the Sitecore instance, Visual Studio ...
2
votes
0answers
75 views

Encrypt zip file while uploading to media library folder sitecore 8.2

i have followed the sitecore link and create my custom processor for (Sitecore.Pipelines.Upload.Save). i have faced issues while saving all media items. it gives error on file.SaveAs(filename); ...
0
votes
2answers
1k views

How to filter an Item's children based on its template?

I have a navigation component that should list the current page in a hierarchy of items. I use below line of code to build navigation tree. return item .GetChildren() .Select(i => ...
0
votes
1answer
600 views

Programmatically Execute Workflow Action of an item from a URL

I am trying to execute a Workflow Action "Approve" or "Reject" from a URL to an ID, is my approach correct? I need help finishing it, how do I run this code from a URL and how do run it on any ID, I ...
1
vote
1answer
381 views

How to add item in contact custom facet List type property

I have created a custom facet model with Sitecore 9.0.1 & xConnect. My contact custom facet contains a property of List<string> which I want to populate with different values while contact ...
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("...
2
votes
1answer
385 views

Sitecore Scheduler job automatically stopped running

I have a sitecore scheduler job running every 60 minutes, It used to be every 10 minutes but after testing I changed it to run every 60 minutes <agent type="XYZ.Scheduler.AdviserSync" method="Run" ...
1
vote
1answer
475 views

Sitecore Scheduled Tasks and Dependency Injection

I am using sitecore workflow action in order to execute method, but the DI inject services not working, what i have to do to solve this issue ? EX: basiclly i have work flow that will call ...
0
votes
1answer
306 views

Is it possible to display field name in View(cshtml) using glass mapper

I am trying to display field name using Glass Mapper in view rendering in following format: FieldName - FieldValue FieldName - FieldValue Ex: Country - USA City - New York I ...
0
votes
0answers
34 views

Sitecore Item Api Fail Fast

i am wondering why did i could create the same Item repeatedly and remove the same item repeatedly on the same requests. Does Sitecore automatically commits database changes on the end of requests? ...
5
votes
1answer
109 views

How to update XDB with customer details in a separate thread

I noticed the call to update the customer details onto xDB is taking considerable amount of time so I would like to do it in a separate thread so that application does not have to wait until the ...
0
votes
1answer
717 views

Get parent item and it's all child item from solr searchresultItem

I have a requirement that needs to get particular item along with all child item or some of the child item using template id from solr searchresultitem. Can anyone help how to achieve this?
1
vote
1answer
482 views

Sitecore GEOIP Issue with load balancer

In a project, I have implemented Sitecore GEOIP to get visitor's country information. In local, it was working fine but when we deployed it in Production environment, GEOIP was not able to get visitor'...
0
votes
3answers
911 views

Getting “Message: Service has been disposed, cannot create object” with Glass.Mapper

I'm using Glass.Mapper v4.5.0.4 and Sitecore 8.2 (rev. 170407). I'm doing an import into Sitecore and am using the SitecoreService.Save(T target) method for creating and saving items. I have the ...
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] ...