I want to call the Site Design apis in my provider hosted app to install site designs. Site design apis are REST apis. But when I trying to call it is always giving me the 403 forbidden error. I am passing the request digest value as well. To test the REST query in provider hosted app I am just calling the lists from a site collection. But it is giving me 403 error. Below is my code, What I am doing wrong here?
- string urlToRequest = clientContext.Web.Url + "/_api/web/lists";
- HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create(urlToRequest);
- endpointRequest.Method = "GET";
- FormDigestInfo formDigest = clientContext.GetFormDigestDirect();
- endpointRequest.UseDefaultCredentials = true;
- endpointRequest.Accept = "application/json; odata=verbose";
- endpointRequest.ContentType = "application/json;odata=verbose";
- endpointRequest.Headers.Add("X-RequestDigest", formDigest.DigestValue);
- HttpWebResponse endpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
MihirPosted Jun 11, 2018, 6:23 AM
MihirPosted Jun 8, 2018, 11:05 AM
Jayakumar BalasubramaniamPosted Jun 8, 2018, 11:01 AM