TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mihir
NA
91
2.8k
How to call REST api in provider hosted app
Jun 8 2018 9:38 AM
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();
Reply
Answers (
3
)
Preserve the Workflow Column Values
Error: Data Not show in asp.net dropdown from sharepointList