Hi Joe,
Cheers for the response and the link, I'm not a dev by any means so apologies if this subsequent response doesn't make a massive amount of sense.
Effectively what I am trying to do is make a GET call from a third party/web app but using either the login token or cookies in the request, using something like
https://apitester.com/ format or the 'Get Data, from Web' in excel as an example.
The software we're trying to connect to can only make a single REST call to retrieve the data and I can get a request to work in python using a 'Session' with two calls but I cannot get it to work without the initial separate call to create the session with cookies.
Example of the code I can get to work is below. I'd love to be able to just use Section 2 of the call without the need for section 1.
SECTION 1 -
import requests
import time
import json
url = "https://SERVER/DocuWare/Platform/Account/LogOn"
userlogininfo={'Username':'user', 'Password':'password', 'Organization':'org'}
# === First Request ===
session = requests.Session()
print(session.cookies.get_dict())
{}
response = session.post(url,userlogininfo)
print(session.cookies.get_dict())
SECTION 2
# === Subsequent request within session ===
updateurl = "https://server/DocuWare/Platform/FileCabinets/b1114fe7-7e73-4c19-8647-efe60d0be069/Documents"
payload = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n\r\n<?xml-stylesheet type=\"text/xsl\" href=\"/DocuWare/Platform/Content/standard.xslt\"?>\r\n\r\n<DocumentIndexFields xmlns:s=\"http://dev.docuware.com/schema/public/services\" xmlns=\"http://dev.docuware.com/schema/public/services/platform\">\r\n\r\n <Field FieldName=\"DOCUMENT_TYPE\" FieldLabel=\"Document Type\">\r\n\r\n <String>UPDATED</String>\r\n\r\n </Field>\r\n\r\n</DocumentIndexFields>"
headers = {
'cache-control': "no-cache",
'Accept': "application/json"
}
response = session.request("GET", updateurl)