Share via

Create site is failing using REST API - Inconsistent behavior

Abdul Saif Babu 61 Reputation points
2021-03-22T15:04:17.863+00:00

REST Endpoint: http://<sp>/_api/web/webs/add

We are getting the below error randomly while creating a site.

Error:
error : {"error_message":{"response_code":500,"code":0,"message":"400 - A required parameter is not specified or has null or invalid value.{\"odata.error\":{\"code\":\"-2147024809, System.ArgumentException\",\"message\":{\"lang\":\"en-US\",\"value\":\"Value does not fall within the expected range.\"}}}}}

Microsoft 365 and Office | SharePoint | For business | Windows

Answer accepted by question author

ZhengyuGuo 10,591 Reputation points Moderator
2021-03-23T05:14:44.777+00:00

Hi @Abdul Saif Babu ,

I'm creating the sub site using "/_api/web/webinfos/add":

Uri: {rootsite}/_api/web/webinfos/add  
Method: POST  
Header: {content-type:'application/json;odata=verbose'}  
Body:{  
   "parameters":{  
      "__metadata":{  
         "type":"SP.WebInfoCreationInformation"  
      },  
      "Url":"NewSubSite",  
      "Description":"NewSubSite description",  
      "Title":"NewSubSite Site",  
      "Language":1033,  
      "WebTemplate":"STS#0",  
      "UseUniquePermissions":true  
   }  
}  

80482-snipaste-2021-03-23-13-13-12.png

80495-snipaste-2021-03-23-13-13-43.png

Reference:

Create Sub Site in SharePoint using REST API

Thanks
Best Regards


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Pankaj Kumar 26 Reputation points
    2021-03-23T10:47:30.333+00:00

    Hi @Jerryzy-MSFT ,

    we have implemented this, as this is inconsistent , we need to test more this, will update

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.