I have a list called Project Log on a sub-site which need to automatically copy any item created in it to another List on the parent site called Master Project Log. This has to be accomplished using the reproducible 2013 workflows.
So far, my workflow looks like the following:
RequestHeader:
- accept - string - application/json; odata=verbose
- content-type - string - application/json; odata=verbose
- content-length - string - 255
Call REST API:
POST https://[domain]/sites/T3W-PM/_api/contextinfo log to ResponseContent
Get d/GetContextWebInformation/FormDigestValue
from ResponseContent
(output to DigestID)
Running the workflow at this point completes successfully and returns the contents of DigestID
which looks like this:
0xFB1B72F8971917CCCB3E605B397CC27ACB758650ACDB98A0848D1BC8CF5A861BD33A0EC0CF094F5D1C3188D842E470A46D25F6CA9780277A74C9AFCEB471423C,12 Aug 2019 09:55:53 -0000
This should be the FormDigestValue
. I then pass that into the RequestHeader
and run a second REST call to create the new list item:
RequestHeader:
- accept - string - application/json; odata=verbose
- content-type - string - application/json; odata=verbose
- X-RequestDigest - string - [workflow variable: DigestID]
metadata:
- type - string - SP.Data.ListItem
RequestContent:
- __metadata - dictionary -
<workflow variable: metadata>
- Title - string -
<current project number>
Call REST API:
POST https://[domain]/sites/T3WPM/_api/web/Lists/getbytitle('[target list]')/items
The second REST call results in a BadRequest error in the workflow log. When I run the same parameters though Fiddler I get a 403 Forbidden error.
This should not happen as the account the workflow is running under is both an Owner with Full Control permissions and a Site Collection Administrator.
Can anyone spot what I'm doing wrong?
In researching this I've seen some references to OAuth authorization but I don't know how to get the OAuth authentication token or if I actually need one.