Looking for help on creating subsites in an existing site using REST api for SharePoint 2010. How can this be done?

My Data part looks something like this

   "parameters": {
   "__metadata": {
     "type": "SP.WebInfoCreationInformation"
          "Url": "Test2",
          "Description": "srinivas",
          "Language": 1033,
          "WebTemplate": "STS",
          "UseUniquePermissions": false

But not sure how should my url contain when submitting POST . http://sharepoint.eur.ad.sag/DCS/India/POC/_vti_bin/ListData.svc/webApp/Sites/Add.

Is webApp/Sites/Add right directive to pass to create a subsite within site POC ?

  • add it in your question May 9, 2017 at 12:16
  • @Arsalan Adam Khatri- i have added it in my Question as to what i have tried . Basically i am using the POSTMAN REST client to perform what i have mentioned in the Question
    – Nis
    May 9, 2017 at 12:25
  • @Arsalan Adam Khatri - How can i share the screenshot here to make things clear to you as to what i have tried at my end ?
    – Nis
    May 9, 2017 at 12:27

2 Answers 2


Try below code.

using (var client = new HttpClient(handler))
    client.BaseAddress = new Uri(webUri);
    client.DefaultRequestHeaders.Add("accept", "application/json;odata=verbose");
    client.DefaultRequestHeaders.Add("X-RequestDigest", formDigest);

    var json = string.Format("{{'parameters':{{'__metadata': {{'type': 'SP.WebInfoCreationInformation'}}, 'Url':'{0}','Title':'{0}','Description':'Sito per la pratica {0}','Language':1033,'WebTemplate':'sts','UseUniquePermissions':false}}}}",nameSubsite);
    client.DefaultRequestHeaders.Add("ContentLength", json.Length.ToString());
    HttpContent httpContent = new StringContent(json);

    httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json;odata=verbose");
    httpContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("odata", "verbose"));

    var getAsyncTask = Task.Factory.StartNew(() =>
        HttpResponseMessage result = client.PostAsync("/_api/web/webinfos/add", httpContent).Result;
        return result;

    response = getAsyncTask.Result;

    //response = client.PostAsync("/_api/web/webinfos/add", httpContent).Result;


Please refer to the documentation: Create subsite with REST API and HttpClient

  • @Nis, Did you tried above solution? Please let me know if you are having any issues while using above solution.
    – Hardik
    May 9, 2017 at 12:25
  • @Hardik- I am not sure which programming language is this in the solution ? I am new to Sharepoint Integration . My use case is to build a simple html page and on click of button i shud create a subsite in Sharepoint . But when i look at the solution you have provided i have two questions - 1) "/_api/web/webinfos/add" isnt this specific to Sharepoint 2013 ? I am looking for solution in Sharepoint 2010 . 2) client.DefaultRequestHeaders.Add("X-RequestDigest", formDigest); - How is formDigest generated ?
    – Nis
    May 9, 2017 at 12:32
  • Above mentioned is c# code & it is for SharePoint 2010 only. Please check entire conversation for the same solution in below given link in the answer. If you want to create subsite using HTML button click then you must go with the JS solution.
    – Hardik
    May 9, 2017 at 12:37
  • If you are looking for JS solution then kindly refer this link...sharepoint.stackexchange.com/questions/88483/…
    – Hardik
    May 9, 2017 at 12:39
  • @Hardik- I really appreciate your help on this topic . But the reference you have given is more for Sharepoint 2013 since url contains /_api in the url . Could you check rest calls to Sharepoint 2010 ?
    – Nis
    May 9, 2017 at 13:01

Use below code to create sub site using rest API,

var fullUrl = siteUrl + "/_api/web/webinfos/add";


        url: fullUrl,

        type: "POST",

        data: JSON.stringify({

            'parameters': {

                '__metadata': { 'type': 'SP.WebInfoCreationInformation' },

                'Url': newSiteUrl,

                'Title': newSiteTitle,

                'Description': newSiteDesc,

                'Language': 1033,

                'WebTemplate': 'sts#0',

                'UseUniquePermissions': false



        headers: {

            "accept": "application/json;odata=verbose",

            "content-type": "application/json;odata=verbose",

            "X-RequestDigest": $("#__REQUESTDIGEST").val()


        success: onQuerySucceeded,

        error: onQueryFailed



function onQuerySucceeded() {

   alert("Site Created Successfully!");


function onQueryFailed(sender, args) {



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.