Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Calling User Profile rest api in https site returns Internal Server Error.

$
0
0

Hi,

I have a REST call to retrieve the profile of the current user in javascript

 $(function () {
 
     getUserInfo();

     function getUserInfo() {
         var theData = ""
   
         var requestHeaders = {
             "Accept": "application/json;odata=verbose",
             "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
         };
   
    
         jQuery.ajax({
             url:_spPageContextInfo.webAbsoluteUrl+ "/_api/SP.UserProfiles.PeopleManager/GetMyProperties",
             type:"GET",
             data: JSON.stringify(theData),
             contentType : "application/json;odata=verbose",
             headers: requestHeaders,
             success:function(data){
                 succesCall(data);
             },
             error:function(jqxr,errorCode,errorThrown){

                 errorCall();
             }
         });
     }

     function errorCall() {
      console.log('this is a fail');
     }
    
     function succesCall(data) {
  console.log('succes');
 }
 });

When I use this code on my local development server it returns exactly what I want. But when I add this code on a page in  a https site then I get an Internal Server Error. On this same site I have different REST Calls that query lists on the site, that work perfectly.

Does anyone know what I need to change to get this working on a https site?

Thanks in advance

Ronald


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>