1

I have developed a List Workflow in Visual Studio 2013.

In this, I am trying to read the current item's Title and create an item in another list in another site collection.

Please read the last part clearly. I have to create an item in a list in a different site collection. But, both the site collections have the same user with contribute permissions. Since I have to create a list item in another site collection, I have no option than to use REST API to create a list Item. But to create a list item using REST API, I need to post a request to http://{siteName}/_api/web/lists/getbytitle('listTitle')/items URL and post the type, Title and other columns and X-RequestDisgest attributes in the payload. I am not sure, how to get the X-RequestDigest in my workflow.

If I skip this digest, I get an unauthorized exception upon checking it in Fiddler. Can anyone please help?

  • sitename/_api/contextinfo as POST will return the FormDigestValue in Fiddler – MickB Mar 18 '16 at 18:22
  • Thank you very much, Mick. But even when I put this Digest into the Authorization Bearer, it is not letting me create in another site collection. I am not sure, whether this is feasible or not. – Ven Mar 21 '16 at 6:47
0

As MickB suggested, sending an empty POST request to /_api/contextinfo will return the FormDigestValue. You need to send this request to the site collection/list that you intend to modify.

Now POST an API call to the endpoint you've posted in your question. Use the returned FormDigestValue in the header for the "X-RequestDigest" (note the typo in your question).

Note that both requests need to utilize HTTP and not HTTPS.

Here is a good write up detailing the above in Fiddler:

SP REST API with Fiddler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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