can you show the Query XML action, as that is where the error is occuring?
This is the action that shows the error, but maybe the web request response is already wrong
The first error is on the "Query XML" action where we try to read the object "FormDigestValue". I have changed this action by dictionaries to get the value as indicated in this post: how to parse json data in nintex workflow for office 365
Now, when I call to /_api/web/sitegroups using "Call HTTP Web Service" action received "BadRequest"
I'm confused on your response. When does which error occur? You made a change, but what was the result?
It looks like your attempt to get the digest worked fine. If it didn't you would have received an unauthorized error, but in your image of the history a digest is there and you quoted a value that has the digest. So that doesn't seem to be the issue.
The first problem was to obtain the digest value using query XML but I resolved them using dictionaries.
Now, when I call Call HTTP Web Service ({Workflow Context:Current site URL}/_api/web/sitegroups) to create the group the result is " Bad request"
Hi,
For your first post, you receive this error ("XML content is invalide .....") because the return of your WebService is in JSON. So you pass JSON to the action "query XML", and that's why you got this error.
In you action, you specify the header : "Accept" : "application/json;odata=verbose", with this you say : "I want the result of this query in JSON format"
You just have to Remove your Header "Accept", and your result will be in XML format. (by default, the /_api/contextinfo will return XML format)
Like :
In your action query XML, you can use this XPath to get the Digest:
//*[local-name()='FormDigestValue']
For your secund error,
I think you error is in your content, may be it's not well formated.
To query this REST end point, you must at least have in your header
"content-type": "application/json; odata=verbose"
"Accept": "application/json;odata=verbose",
"X-RequestDigest":"......."
And in your content :
{
"__metadata": {
"type": "SP.Group"
},
"Title": "groupName",
"Description": "group desc"
}
@nico wrote:
...
For your secund error,
I think you error is in your content, may be it's not well formated.
To query this REST end point, you must at least have in your header
"content-type": "application/json; odata=verbose"
"Accept": "application/json;odata=verbose",
"X-RequestDigest":"......."
And in your content :
{
"__metadata": {
"type": "SP.Group"
},
"Title": "groupName",
"Description": "group desc"
}
Thanks a lot @nico but the second part continues to fail.
And the result is:
According to the post I followed, it is not necessary to specify any parameters for the creation of the group.
Any idea what is missing?
Thank you
I don't see the error too ...
May be nintex build and pass your parameter with a wrong format (the "request content").
Have you try to use the "web request" action (instead of a "call http web ervice") and pass your JSON in the "body" of your request ? (and not use build dictionnary to create your JSON)
Hi @nico
I used "web request" and pass my JSON on the body directly and the result is bad with different text
@fhunthAny idea?
Be carful, you pass a wrong content type in your request.
Your body is in JSON format, and in your query Content type (in the header) the value is XML.
Change your "content type" value with : "application/json;odata=verbose"
(I have just test it, and I have sucess full create a SPGroup)
Thanks @nico . It must have been some proof. I have reviewed all the headers and I have the same as the photo you send. The result is the same
If I use web request:
Store response Content: {"error":{"code":"-2130575251, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your
If I use Call http Web Service:
headers: {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The property '__metadata' does not exist on type 'SP.Group'. Make sure to only use property names that are defin
The only difference is that Web request I can pass the contents of the body and headers directly and with call I have to use dictionaries.
If you have a solution that works, there would be a possibility that you would export that WF and send it to me and I'll try it (deleting your username and password)
No problem for exporting the Workflow, see it in attachment (I have renamed the package with .zip, remove it before import)
An exemple of the result :
Note : In my 2 "Web Request" actions, I set my Email / password, else I have an UnauthorizedAccessException
Be carefull, there is actualy a bug when you want to use JSON and workflow varariable.
You can find some workaround here :
https://community.nintex.com/t5/Nintex-for-Office-365/Build-string-jSon-and-workflow-variables-not-working/m-p/24979#M3405
https://community.nintex.com/t5/Nintex-for-Office-365/Changing-Site-URL-and-Title-via-Nintex-Workflow/m-p/35921#comment-34390
Good luck
@nico Your solution works!
I think the difference (and the error) is in passing the content in a string and not in a dictionary.
Thank you very much for your time and help.