Stop Ajax-Restful service from prompting login?

Sean Su 1 Reputation point

How to stop Ajax-Restful service from prompting login?
It is an anonymous site, but Restful api requires people to log in. Is there way to stop it?

SP.SOD.executeFunc("sp.js", "SP.ClientContext", function() {
SP.SOD.executeFunc("sp.runtime.js", "SP.ClientContext", function() {
var context = SP.ClientContext.get_current();

var queryUrl= "/sites/publicaccess/sitename/_api/web/lists/getbytitle('EssentialVisitorList')/items?$Select=*,Editor/Title&$Expand=Editor/Title";
var qryStr = "&$filter=(ApptLocation eq '" + splitStr + "')";

    url: queryUrl,
    method: "GET",
    headers: {
      "Accept": "application/json; odata=verbose"
    success: onQuerySuccess,
    error: onQueryError


SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,557 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points

    You could try to run the following powershell command :

    $web = Get-SPWebApplication -Identity http://your web address  
    $web.ClientCallableSettings.AnonymousRestrictedTypes.Remove( [Microsoft.SharePoint.SPList],"GetItems")  


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments