Skip to main content
Nintex Community Menu Bar

How to execute a SP2013 REST API request with Nintex Workflow


Did this topic help you find an answer to your question?
Show first post

91 replies

Hi Sorav,
I have sane problem as of yours. Can you please share your answer to me like what type of changes you made.

Translate

Forum|alt.badge.img+5
  • 49 replies
  • June 13, 2017

Hi Caroline,

Oh, yes, until this afternoon I had the metadata parameter, and it produced the same error. I removed this afternoon after reading something online, and I thought it would work...but it didn't

Thanks,

Katherine

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 13, 2017

Can you try with the following XPath query?

//*[local-name()='Employee_x0020_Name']

Translate

Hi,
I have tried this but its not working.

I am attaching the screen-shot of the result.

It is giving back XML

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 13, 2017

Hi,

Is your XML beginning with "Response status code: 200 Response content:" or with "<?xml version="1.0" encoding="utf-8"?><entry xml:base="http://brvm153:45438/sites/devs/tb/_api/""?

It should begin with "<?xml version="1.0" encoding="utf-8"?><entry xml:base="http://brvm153:45438/sites/devs/tb/_api/""

I hope it will work

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 13, 2017

Hi Katherine,

Can you remove "Accept" header and try again?

Regarding "Content-type" header, is it the header automatically added when you select POST method?

Translate

Forum|alt.badge.img+5
  • 49 replies
  • June 13, 2017

Hi Caroline,

I removed the accept header and received this error message:

<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-2130575251, Microsoft.SharePoint.SPException</m:code><m:message xml:lang="en-US">The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again.

Yes, the content-type header is automatically added (and required) when you select the POST method. 

*Edit* I have noticed in the response header the first line is: ["Transfer-Encoding=chunked","Cache-Control=private, max-age=0","Content-Type=application/json;odata=verbose;charset=utf-8","Expires=Tue, 30 May 2017 07:04:49 GMT","Last-Modified=Wed, 14 Jun 2017 07:04:49 GMT". Could that first date be causing all these issues?

I was just wondering - is there another way to create a subsite without using the 'create site' action?

Thanks,
Katherine

Translate

No my xml starts with <?xml version="1.0" encoding="utf-8"?><entry xml:base="http://brvm153:45438/sites/devs/tb/_api/

Translate

Hi Caroline,

I have check my XML start with same string as you say. I doubt it can be environment difference. Mine is SharePoint 2013 on- premise version. Can you please share your environment. If you need more details regarding my environment configuration then I can be reached at my email-id. I would be really happy to get more help.

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 14, 2017

Hi Katherine,

I think that the error message that you received is due to the request digest. Which url do you use to get the request digest?

I don't know any other way of creating a subsite without the "create site" action, sorry.

There's another url that you can use but it's almost the same that you've used :

{Workflow Context:Current site URL}‍/_api/web/webs/add

With the exact same headers but the following body (you can add the description as well) :

{ 'parameters': { '__metadata':{ 'type': 'SP.WebCreationInformation' }, 'Title':'Created From WF','Url':'createdwf', 'WebTemplate':'STS#0', 'UseSamePermissionsAsParentSite':true } }

Hope this helps

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 14, 2017

Hi Kunal,

Can you share with me the whole XML you're using to test the XPath query?

You're right, it can't be due to an environment difference and there's no specific configuration that can alter the proper functioning of this action.

Translate

Forum|alt.badge.img+5
  • 49 replies
  • June 15, 2017

Hi Caroline,

I didn't think there was another way...but just in case I thought it better to ask.

Unfortunately, this produces the same error as /web/webinfos/add. Could it be possible that this is an error with Nintex/SharePoint?

Thank you for your time and help

Translate

Forum|alt.badge.img+5
  • 49 replies
  • June 19, 2017

Hi Caroline,

Thanks for your help - it wasn't working within the App Step action. I took it out of the app step, and it now works

Katherine

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • June 19, 2017

Hi Katherine,

Thanks a lot for your feedback !

That's good to know

I'm glad that you could finally get your workflow working .

Have a nice day,

Caroline

Translate

Forum|alt.badge.img+5

Caroline,

I was able to build a Nintex Workflow to permanently delete content (bypass recycle bin) using this post as a baseline.

Many thanks to you,

-JC

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • July 17, 2017

Hi Joseph,

Thanks for your feedback, I'm really happy that this blog can help !

Have a nice day,

Caroline Jung

Translate

Forum|alt.badge.img+3
  • 12 replies
  • August 3, 2017

Hello,

I am trying to follow your example here, but I am having some difficulties following your variables.  Are the variables listed with txt in front variables or columns?  Along with what does the num_ID have to be in your example?  Just something to differentiate the item?  And is webURL just a variable that contains the URL of the API you are getting info from?

Thank you,

Duncan

Translate

Forum|alt.badge.img+16

WebURL is a common property supplied by the Nintex actions themselves and gives you the current web address.

I would imagine the workflow variables called txt... are single line of text variables and have been named in that way so that you can see quickly what type they are.

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • August 4, 2017

You're absolutely right Cassy I have the habit to prefix variable names with something that help me identifying the type of the variable.

WebUrl is the reference that you can find in "Common" tab when adding a reference and correspond to the absolute url of the current web site.

In my example, "numID" is a workflow variable where the list item id of an item is stored.

Don't hesitate if you have other questions

Translate

  • 2 replies
  • August 16, 2017


I am trying to remove an external users permissions from a document with a post request

I was able to get the Request Digest, however when I try to do a post request ‌to /_api/SP.Sharing.DocumentSharingManager.UpdateDocumentSharingInfo I get the following error
‌{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"Not well formatted JSON stream."}}}

I think the issue is to do with the body, which I have built up into a single variable.
{'resourceAddress':'https://xxx.sharepoint.com/sites/xxx/xxx/xxx.docx','userRoleAssignments':[{'__metadata':{'type':'SP.Sharing.UserRoleAssignment'},'Role':'0','UserId','xxx@xxx.com'}],'validateExistingPermissions':false,'additiveMode':false,'sendServerManagedNotification':false,'customMessage':'','includeAnonymousLinksInNotification':false}

I have tried single quotes, double quotes, escaping the quotes, but I get the following error message.
{"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"Not well formatted JSON stream."}}}

I have verified that the following does work in javascript
var data = "{""resourceAddress"":""https://xxx.sharepoint.com/sites/xxx/xxx/xxx.docx"

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • August 17, 2017

Are you using Nintex for O365 or Nintex for SharePoint Onpremise?

Translate

  • 2 replies
  • August 18, 2017

Thanks for your response. It was for Nintex for O365. I re-created a new web request with the same configuration and that seemed to do the trick. There was nothing wrong with the body variable after all. Thanks again

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • August 18, 2017

Great, I'm glad that you could find a solution to your problem

Translate

Forum|alt.badge.img
  • 4 replies
  • August 28, 2017

Caroline,

Thank you so much for the information.  I was able to use it to create an item in a list on a different site with the Web request action, and then update a column in the new item.  I also need to add any attachments from the original list item to the new item, but haven't found the right combination of URL, headers and json to make it work however.  Any help you could give me would be most appreciated.

I have it working so the file name is attached to the new item, but if you open that attachment, it just shows you a small x, so it doesn't look like the actual file was attached.  By the way, I am doing this cross-domain.

My URL looks like this:

<website>/_api/web/Lists/getByTitle('HotWorkPermitsFromExternal')/items(54)/AttachmentFiles/add(FileName='1503678393715584089584.jpg')

The content type is application/json;odata=verbose

I have Headers of X-RequestDigest with a value of the digest request you explained how to get,

and IF-MATCH with a value of *

Translate

Forum|alt.badge.img+9
  • Author
  • Scholar
  • 399 replies
  • August 28, 2017

I'm glad that this blog has helped you .

Regarding list item attachments, here's the documentation to retrieve list item attachments (one request for the properties such as the file name and one request for the file content using $value) and to add new attachments:

https://dev.office.com/sharepoint/docs/sp-add-ins/working-with-folders-and-files-with-rest#FileAttachments

You could retrieve attached files from one list item and based on information you've retrieved you could create attachments to the other list item.

Hope this helps

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings