I'm trying hard to make work this code:
shptService.create_board = function (url, title, description, template) {
//ensure form digest
shptService.ensureFormDigest(function (fDigest) {
$.ajax({
url: shptService.hostWebUrl+"/_api/web/webinfos/add",
type: "POST",
data: JSON.stringify(
{
'parameters': {
'__metadata': { 'type': 'SP.WebInfoCreationInformation' },
'Url': url,
'Title': title,
'Description': description,
'Language': 1033,
'WebTemplate': 'sts',
'UseUniquePermissions': false
}
}
),
headers: {
"accept": "application/json; odata=verbose",
"content-type":"application/json;odata=verbose",
"X-RequestDigest": fDigest
},
success: doSuccess,
error: doError
});
});
};
i got from this source : https://msdn.microsoft.com/en-us/library/office/jj164022.aspx#bk_CreateSite but I'm having this error : 403 (Forbidden) .can anybody tell me why i'm getting this problem or a solution is better.