kmcollins
Nintex Observer

How to create a site using web service calls?

Jump to solution

Hi,

We have a workflow that will need to create a site (eventually using a custom template). However, the problem is we only have a standard license, so there is no 'create site' action. I have been trying to do this via a web service call (using this Nintex Workflow SharePoint Online Create Sub Site using Call HTTP Web Service Action | reshmeeaucklo...  post), but I'm getting a bad request response, and of course the site isn't being created. I have noticed that posts for Nintex on-prem use a different call - is this correct?

I have given the workflow full permissions as outlined in all the articles, and have tried with a variety of urls (there seems to be a lot of debate on what needs to be in the url field), the same with template values (at the moment I'm just using sts, but have tried a variety of STS, STS#0, sts) all with the same result.

Does anyone have any ideas on what we need to do to get this things live? More than happy to use web request rather than a service call if that's what's needed.

I'm using Office 365/SharePoint Online and Nintex Standard 365.

Reply
13 Replies
TomaszPoszytek
Automation Master
Automation Master

Re: How to create a site using web service calls?

Jump to solution

Hi!

What I would suggest you is to try execute your web request using tools like Fiddler Composer or Postman‌. If you succeed there, using the same parameters, then you can start being worry However, from my experience, in O365 all calls (besides those requiring binary data) to the Sharepoint REST Service‌ endpoints are working.

The only thing you should try as well is to add, to your request's headers, the "cookie" header, containing FedAuth and rtFa‌ cookies' values. For testing purposes you can simply look into the Network tab of the Developer console, of your browser, and there you will find these cookies:

If you would like then to automate it, then you can follow guidelines from my post here: https://community.nintex.com/community/build-your-own/nintex-for-office-365/blog/2017/02/09/working-...

Regards,

Tomasz

Reply
kmcollins
Nintex Observer

Re: How to create a site using web service calls?

Jump to solution

Hi Tomasz,

I just figured out this morning how to test this with Postman (completely missed the raw option for body). I have also made a switch in the workflow to use a web request action rather than a http web service action. This produces a security issue - would this be resolved by supplying the above cookies?

When I use a http web service action, the response always tells me that the first parameter (regardless of what it is) does not exist in the method 'Add'. Which is the better action to use to create a site?

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to create a site using web service calls?

Jump to solution

 I'm glad you figured it out. Do you succeeded creating site using Postman?

 Regarding your action: can you post a screen shot of the action's configuration.

On the other hand, why can't you use the "Office 365 Create Site" action? (http://help.nintex.com/en-US/o365/#o365/O365WorkFlow/WorkflowActions-INT/Office365CreateSite.htm?Hig... site)? 

 Regards,

 Tomasz

0 Kudos
Reply
kmcollins
Nintex Observer

Re: How to create a site using web service calls?

Jump to solution

Hi Tomasz,

Yes, I can now create a site using Postman! I still can't get the workflow to create a site though. The parameters are all the same, and the web request action still produces a security error, and the HTTP web service action insists that parameters do not exist in the method 'Add'.

Is there something glaringly obvious I'm missing?

I would love to use the O365 action for this, but it's part of the enterprise license, and we only have standard

*Edit*

I started also receiving this error code: code: -2130575251, Microsoft.SharePoint.SPException for the web request. I looked it up and it means the protocol server requires a form digest but the form digest in the X-RequestDigest HTTP header is not as same as the one generated by the protocol server. 

Does anyone know how to resolve this issue?

Because I'm all out of ideas...and any help would be greatly appreciated!

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to create a site using web service calls?

Jump to solution

Try using the FedAuth and rtFa cookies

0 Kudos
Reply
kmcollins
Nintex Observer

Re: How to create a site using web service calls?

Jump to solution

Hi Tomasz,

I'm a little confused here - Postman can create a site with just request digest, why does Nintex need authentication cookies? 

Also, I thought providing a username/password for the web request action would generate authentication for the header?

*Edit* I tried running the workflow with X-requestdigest and FedAuth and rtFa cookies, the response was a straight up access denied.

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to create a site using web service calls?

Jump to solution

That is veeeryyy odd.. But you are right - I confirm. Both using "Web Request" and "Call HTTP Web Service" actions I'm receiving access denied. No matter if I provide cookies or requestdigest token.

I have no time to verify if other REST calls work, eg. to create a list item or list itself, or to get file contents. IMHO this should really work. I see no reason why it does not (or stopped). Maybe there is something going on behind. Dunno.

I stuck. Please contact support@nintex.com and describe your problem. They should follow you up with a possible reason for such behavior, but this can take days (usually 2). To speed it up you can provide them with your exported workflow. Or take mine (it's a site workflow).

Regards,

Tomasz

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to create a site using web service calls?

Jump to solution

ummm... I know it's a poor workaround, but maybe try with SharePoint Designer workflow or Microsoft Flow?

Regards,

Tomasz

0 Kudos
Reply
kmcollins
Nintex Observer

Re: How to create a site using web service calls?

Jump to solution

Hi Thomasz,

I would use SharePoint designer, except running the same call there results in the below error:

{"error":{"code":"-1, Microsoft.Data.OData.ODataException","message":{"lang":"en-US","value":"An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected."}}}

The same happens when I use a http web service call in Nintex. I have also been unable to resolve this issue. I don't suppose you would have any suggestions on this one?

0 Kudos
Reply