I need to get data from Sharepoint online list by using rest api.I will use the get and post method (post method in camel query case).
urlapp: the encoded url such as(https://name-29a8f2a9e3342d….)
$ .ajax({ url: urlapp+ "/../_api/web/lists/getbytitle('Letters')", method: "GET", headers: { "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", }, async: false, success: function (data) { console.log(data);//Debug statement }, error: function (error) { console.log(error); } });
the previous code generate the 403 (Forbidden) error. After searching I found solution by using executeAsyn (new SP.RequestExecutor),but I need some way is sync execution not async.