attempting to fetch images of a private unlisted group wiki page via API

Hi,

We are trying to fetch content and its images of a wiki page from api call of a private unlisted group.  we are able to fetch the content but if we are trying to retrieve images its throwing error 403 error as forbidden.

even we tried with admin login also no luck :( 

Parents
  • We tried the following case:

    case 1 : we had created a plugin , tried 

    Apis.Get<IUsers>().RunAsUser(RunAsUserID, () =>
    				{
    				
    			image = Image.GetInstance(src);
    				});
     

    case 2:

    using Rest sdk

    var         adminKey = String.Format("{0}:{1}", "8nobz9x7io5b4r4d", "abcd");
    			var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));
    			string imageurl = "http://devcommunity.name.com/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-04/google.png";
    			using (var client = new WebClient())
    				{
    					client.Headers.Add("Rest-User-Token", adminKeyBase64);
    					byte[] imageBytes = client.DownloadData(imageurl);
    					var data = imageBytes;
    					var imagearray = Convert.ToBase64String(data);
    					var dataUrl = "data:image/png;base64," + imagearray;
    				}

    For both the cases it throws error as follows:

    NVelocity.Exception.MethodInvocationException: Invocation of method 'imageinstances' in  GetImagesOfWikis threw exception System.Net.WebException : The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
       at System.Net.HttpWebRequest.GetResponse()

    It works fine for all Group Types Except Private Listed & Private Unlisted.

Reply
  • We tried the following case:

    case 1 : we had created a plugin , tried 

    Apis.Get<IUsers>().RunAsUser(RunAsUserID, () =>
    				{
    				
    			image = Image.GetInstance(src);
    				});
     

    case 2:

    using Rest sdk

    var         adminKey = String.Format("{0}:{1}", "8nobz9x7io5b4r4d", "abcd");
    			var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));
    			string imageurl = "http://devcommunity.name.com/resized-image/__size/320x240/__key/communityserver-wikis-components-files/00-00-00-00-04/google.png";
    			using (var client = new WebClient())
    				{
    					client.Headers.Add("Rest-User-Token", adminKeyBase64);
    					byte[] imageBytes = client.DownloadData(imageurl);
    					var data = imageBytes;
    					var imagearray = Convert.ToBase64String(data);
    					var dataUrl = "data:image/png;base64," + imagearray;
    				}

    For both the cases it throws error as follows:

    NVelocity.Exception.MethodInvocationException: Invocation of method 'imageinstances' in  GetImagesOfWikis threw exception System.Net.WebException : The remote server returned an error: (403) Forbidden. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
       at System.Net.HttpWebRequest.GetResponse()

    It works fine for all Group Types Except Private Listed & Private Unlisted.

Children