I am trying to make a POST request to add a new item to a SharePoint list in SharePoint online, from a classic page. I am having this code in my custom action:
var url = location.href
var initiativeName = $("#idDocsetName").text()
var target = "https://tenantname/sites/sitename/_api/web/lists/getByTitle('Requests Approvals')/items"
var data = '{ "__metadata": { "type": "SP.Data.Requests_x0020_ApprovalsListItem" }, "Title":"'+ requestName+'", "requestURL":"'+ url +'", "ManagerEmail":"'+ email+'"}'
$.ajax({
url: target,
type: "POST",
contentType: "application/json;odata=verbose",
data: data,
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"content-Type": "application/json;odata=verbose"
}
})
I am getting 403 error. How can I know more what's needed? when I click on the request details, I find this: