Using REST API if you want to update item then no need to get Access Token It is run in browser so used logged in user credential. You just need to pass request digest value.
– Samir KhimaniJan 19 '17 at 9:32

I know request digest value. My first request is on server.domain/_api/contextinfo to get digetst value and this digest value I use in my second request as parametr in X-RequestDigest: header but I still get 401 error on my second request
– soldousJan 19 '17 at 9:40

Request digest value is valid for particular time limit. Can you please check during second request request digest value is valid or not?
– Samir KhimaniJan 19 '17 at 9:47

1

Reuqest for digest value last 74 ms and my second request is called right after the first one. And of this site I find that error message if the digest value is not valid is different (403 FORBIDDEN) so I don't think so that the problem is with the digest value
– soldousJan 19 '17 at 9:59

I searched on the internet and I found that <TenantID> is always on sharepoint on Office 365 but we have only SharePoint Foundation. When I tried the link server.domain/_vti_bin/client.svc I got xml with Microsoft.SharePoint.Client.ResourceNotFoundException Resource for request cound not be found so is this method supported on SHP Foundation?
– soldousJan 19 '17 at 11:44