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.\"}}}}}

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,687 questions
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points
    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.

    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