Creating subsites using REST API from SharePoint Designer Workflow

I absolutely love SharePoint 2013 style workflows solely because of the Call Web Service action. It is hands-down one of the coolest features as it allows you to build some really amazing solutions.

I’m documenting this for my own benefit but if you happen to be in the same boat trying to build your own solution – I hope this helps!

Starting point: make sure that you have configured workflows to be able to run with elevated privileges in your site collection. Rather than re-invent the wheel, just follow this Microsoft article. From there, create a brand new Reusable workflow. The first step will be to create a variable called RESTUri of type string and have it be combining the Workflow context current site URL + /_api/web/webinfos/add. This is going to be URL that the Call Web Service will access:


Next you have a few Dictionaries to create:

1. RequestHeaders which will contain both Accept & Content-Type with the value of: application/json;odata=verbose


2. Metadata which will contain just a single entry of type as string with the value: SP.WebInfoCreationInformation

3. JSONRequest which will contain a bunch of different values:

Name Type Value
Url String This is the site name in the URL example: http://sharepoint/sites/site1/subsite (reference the list column value)
Title String The Site Title (example: Jared’s Awesome Site)
Description String The Site Description (example: Jared’s Awesome Site is a world class SharePoint blog)
Language Integer 1033 (for English, others here)
WebTemplate String STS#0 (Reference this blog for more choices)
UseUniquePermissions String true/false – if you want to inherit permissions go with false
__metadata Dictionary Workflow Variable:Metadata (defined earlier – make sure it’s a double _ underscore)


4. Params which will contain a single entry called parameters as type dictionary with the value of the JSONRequest variable.


Great! Now that you’ve set all that up, create your App Step and add a “Call Web Service” action inside of it. (If App Step is greyed out, please see here again)

You’re going to want to click on the word “this” and insert the variable RESTUri in the “Enter the HTTP web service URL” spot and then specify this as a POST method.


Click ok, then click on the word “request” and select the Params variable you had created. Your call web service action should look like this now:


Now, right click on the call web service action and click the properties button. Map the RequestHeaders to the variable you’d created, create a new dictionary called ResponseContent and map that to the ResponseContent.


Then click OK.

I like to add a step after the web service call which logs the responseCode variable to the workflow history so I know if it was successful or not. When it’s not and I’m troubleshooting, I’ll create an e-mail task which then sends me the ResponseContent so I can get more information about the error that’s being thrown.

If you’re good, go publish your workflow and click OK at the prompt about the App Step.

This is what my workflow looks like at this point:


Now go attach this new workflow to your list which should have columns for: Title, Description, and URL.

One other fun little tidbit which I’ll give thanks to Fabian Williams for is that the AppStep can be a little tricky. If your workflow is throwing “Unauthorized” errors, check out Fabian’s blog post.


11 comments on “Creating subsites using REST API from SharePoint Designer Workflow”
  1. Arzu says:

    Thank so much for this post. It’s great. I try so many sites in the Internet without success. The reason was, that nobody write the note that it’s important to make sure it’s a double underscore in metadata!!! I wrote always one underscore 🙁
    I’m so happy! Thanks

  2. I am having an issues getting Bad Request in my request code, I have rebuilt this a few time same result not sure what I am missing. I could really use some help!!

    1. Hey Dorinda,

      So BadRequest typically means there’s an issue with the URL that you’re calling. Did you try to hardcode it vs create dynamically – ie;

      Take that URL and browse to it – because it’s a GET it won’t create the site but it’ll ensure that you’ve got the URL correct.

      Best regards,

  3. Craig says:

    Hi Jared,
    Is the methods the same if you want to create a subsite in a different site collection? Will the app permissions of the workflow in the source site (where the workflow runs) need to be applied to the destination Site collection (where the site is to be made)?

    1. Hey Craig – sorry for not getting back to you. I believe you’ll need to set workflow permissions on the destination site collection to make that work. Basically follow the same steps to give the workflow process SCA access as per –

      1. Craig says:

        Hi Jared, I found an easier way;
        Instead of setting the workflow permission on each destination SC (we have over 350, so this would be time consuming), we can edit the XML for the AppPermissionRequest in the SC that houses the workflow to auto-provision the sites.

        Therefore, instead of applying:
        AppPermissionRequest Scope=”http://sharepoint/content/sitecollection” Right=”FullControl” />

        We can apply:
        AppPermissionRequest Scope=”http://sharepoint/content/tenant” Right=”FullControl” />

        This bypasses the need for adding the WF as trusted for each SC & therefore only need to do the AppPermissionRequest in 1 place.

        Happy days 🙂

      2. That’s totally an awesome nugget of info – you have a blog? I’d love to link to it.. Otherwise if you don’t mind, I’ll write it up quick and give you credit for finding it!

  4. Nicole says:

    Hello Jared!

    Is there a possibility to set the Navigation Inheritance as well through the creation, or at least the workflow?
    Also I’ve implemented this on Office365 – the workflow got stuck at the parameter dictionary. I had to remove the __metadata from the parameter dictionary, then it worked fine (the creation).


Leave a Reply to Jared Matfess Cancel reply