-
Notifications
You must be signed in to change notification settings - Fork 1k
Issues creating site script with SharePoint REST API #6944
Copy link
Copy link
Closed
Labels
area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APICategory: SharePoint Client Side Object Model SDK / REST APIarea:site-designCategory: Site Designs/Site ScriptsCategory: Site Designs/Site Scriptstype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:questionQuestion... if answered, will be tagged as such.Question... if answered, will be tagged as such.
Metadata
Metadata
Assignees
Labels
area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APICategory: SharePoint Client Side Object Model SDK / REST APIarea:site-designCategory: Site Designs/Site ScriptsCategory: Site Designs/Site Scriptstype:archive-old-issueIssues which are closed as tool old for active workIssues which are closed as tool old for active worktype:questionQuestion... if answered, will be tagged as such.Question... if answered, will be tagged as such.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What type of issue is this?
Documentation issue / typo
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Target SharePoint environment
SharePoint Online
What browser(s) / client(s) have you tested
Additional environment details
Issue description
I am attempting to create a site script using the SharePoint REST API endpoint (/_api/Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility.CreateSiteScript) but I am continuously getting a 400 error with the message "The server encountered an error processing the request. See server logs for more details." I am closely following the documentation (https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-rest-api). I am using the sp-request library to call the API and have had no issues with getting site designs on my tenant or deploying updates to site designs. It seems to be an issue with the endpoint. Below is my code:
`
const siteScript = {
"$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json",
"actions": [
{
"locale": 1033,
"verb": "setRegionalSettings"
},
{
"group": "Owners",
"principal": "ContosoAdmins",
"verb": "addPrincipalToSPGroup"
}
],
"bindata": {},
"version": 1
};
Is the issue with the formatting of the body?