I'm currently reading up on using REST urls to add data in SharePoint 2013 On-Premises. Ultimately, I'd like to use JavaScript to leverage REST. I found this guide about testing this functionality through Fiddler.
I have run into some errors and I'm hoping someone here can help me identify why.
My request in Fiddler composer:
POST http://sp2013/_api/web/lists/getByTitle('TEST‘)/items HTTP/1.1
ACCEPT: application/json;odata=verbose
Content-Type: application/json;odata=verbose
X-RequestDigest: 0x9D22271840E34310DC94173D764AA679D3E1FD9F8F3C56816C64D7EC7769D6373CCC14F4EF5095FCABAC115B81ECC5CA767606603A9F800C4A26B00263548DF9
Host: sp2013
Content-Length: 104
Request Body:
{‘_metadata':{‘type':’SP.Data.TESTListItem’},
‘Title':’My Item’};
I get 403 back after execution. Error message under JSON tab “value=The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.”
Inspectors > Headers
Request Headers POST /_api/web/lists/getByTitle(‘TEST’)/items HTTP/1.1
Client: ACCEPT: application/json;odata=verbose
Cookies/ Login: Authorization: NTLM TlRMTVNTUAADAAAAGAAYAH4AAABgAWABlgAAAAwADABYAAAADAAMAGQAAAAOAA4AcAAAABAAEAD2AQAANYKI4gYDgCUAAAAPaXDnH+TwVxwmtRoMN7kF80IAQQBNAEIATwBPAGsAcABpAG4AdABvAEsAUABMAFQANwA2ADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA29lgEyWuouINwQXxvOAE+QEBAAAAAAAAxZdD0ROU0AGyvCMcqiyyCgAAAAACAAQAUQBBAAEAEABNAEIAUwBQADIAMAAxADMABAAeAHEAYQAuAEIAYQBtAGIAbwBvAC4AbABvAGMAYQBsAAMAMABNAEIAUwBQADIAMAAxADMALgBxAGEALgBCAGEAbQBiAG8AbwAuAGwAbwBjAGEAbAAFABgAQgBhAG0AYgBvAG8ALgBsAG8AYwBhAGwABwAIAMWXQ9ETlNABBgAEAAIAAAAIADAAMAAAAAAAAAABAAAAACAAAOsI1DrUsj/QuC65hIvjd7wGOaN4bv579Bsas1/lTiGMCgAQAAAAAAAAAAAAAAAAAAAAAAAJADoASABUAFQAUAAvAG0AYgBzAHAAMgAwADEAMwAuAHEAYQAuAGIAYQBtAGIAbwBvAC4AbABvAGMAYQBsAAAAAAAAAAAAAAAAALBGUQ6shfqgaazYVFVgWks=
Entity Content-Length: 73 Content-Type: application/json;odata=verbose
Miscellaneous X-RequestDigest: 0x9D22271840E34310DC94173D764AA679D3E1FD9F8F3C56816C64D7EC7769D6373CCC14F4EF5095FCABAC115B81ECC5CA767606603A9F800C4A26B00263548DF9